public
Description: Merb More: The Full Stack. Take what you need; leave what you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-more.git
commit  7b7e1ec954aa45738a0b8f4fbefefa83505642c0
tree    b7c65a0845be500fa86cac048f80ccff05573b40
parent  d549e3ad67c4a1bc2e4e0073096a793a90a7c4c0
merb-more / merb-gen / README
100644 36 lines (23 sloc) 1.789 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
==== merb-gen
 
merb-gen is a part of the Merb More package. It 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, <tt>merb-gen app foo</tt> 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.
 
Use <tt>merb-gen core</tt> to generate minimal merb-core application with full layout.
Use <tt>merb-gen flat</tt> to generate a flattened application (very simple directory structure)
and <tt>merb-gen very-flat</tt> to generate a single file application.
 
To generate a new merb plugin, run merb-gen plugin &lt;plugin_name&gt;.
 
To see what generators are available, run merb-gen generators.
 
==== 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