wycats / merb

master merb branch

This URL has Read+Write access

wycats (author)
Wed Dec 31 01:13:25 -0800 2008
commit  1d088fdb1c130a7bc4adffb9a646498623aad6af
tree    eb264147cd03da3be9ab94bc26d6ae7f1c16e6b4
parent  f82cd530f57e9662e4ab75fa262d460ee4382afa
merb / merb-gen
name age message
..
file .gitignore Fri Jan 18 11:25:19 -0800 2008 Leftover files [wycats]
file LICENSE Mon Sep 22 22:30:22 -0700 2008 Fix license files in merb-more. [michaelklishin]
file README Thu Oct 09 16:45:42 -0700 2008 Update merb-gen README. Thanks for pointing the... [michaelklishin]
file Rakefile Loading commit data...
file TODO Thu Jun 26 04:23:27 -0700 2008 added migration generator [jnicklas]
directory bin/
directory lib/
directory spec/
merb-gen/README
==== 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