Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

This branch is 265 commits ahead of wycats:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
bin
docs
lib
spec
.gitignore
.rspec
LICENSE
README.mkd
Rakefile
TODO
merb-gen.gemspec

README.mkd

merb-gen

merb-gen provides application, plugin, and component generators for Merb.

Usage

To generate directory structure for a new merb app, run

merb-gen app <app-name>

For instance, merb-gen app foo would create a new foo merb stack application inside of the foo directory. Merb stack sets up commonly used Merb and DataMapper gems to quickly get you started.

To se what generators are available, run

 merb-gen generators.

Application Profiles

Instead of app, merb-gen supports the following profiles:

  • core -- generate minimal merb-core application with full layout.
  • flat -- a flattened application with a very simple directory structure.
  • very-flat -- a single-file application.

Plugin Generation

To generate a new merb plugin, run

merb-gen plugin <plugin_name>

Custom generators

There are two ways of adding generators, depending on how the generators are intended to be used. The first way is by adding adding the generator via

Merb.add_generators

and specifying the location of any generators:

Merb.add_generators File.join(File.dirname(__FILES__), 'generators', 'my_generator.rb')

This method has some advantages:

  • it allows you to load generators only when your plugin is required in the application
  • it allows you to load generators from inside the application itself

However, it also has a disadvantage: it is impossible this way to add generators whether the plugin is loaded or not, just by virtue of the gem being installed. This is where the second way comes in: A 'Generators' file is added to the root of the project (like a Rakefile), it should look something like this:

scope "merb-gen" do
  Merb.add_generators File.join(File.dirname(__FILES__), 'generators', 'my_generator.rb')
end
Something went wrong with that request. Please try again.