Sha256: 8b690fe06c23b7fe238b6e9bea37f1b49f32001cdd4c14b505d21655549085a0

Contents?: true

Size: 1.62 KB

Versions: 9

Compression:

Stored size: 1.62 KB

Contents

How to create a Generator (aka Component Generator)
======================================

1. Run this generator: script/generate component_generator mygen scope
   Where "mygen" is the name of the generator, and scope is scope restriction.
   A scope of "rubygems" means this generator will only be available to RubyGems developers. 
   A scope of "rails" means the generator is only accessible to Rails applications
2. Using the generated test class, assert what directories, files, classes etc should
   be generated.
3. Add these files into the scope_genearators/mygen/templates folder. Your files can use
   ERb (that is, <%= ... %>), and are called 'templates'.
4. Specify the files in /templates are copied/templated at generation time within rubygems_genearators/mygen/mygen_generators.rb's #manifest method.
   Use m.file for files to copy over.
   Use m.template for files containing ERb. Create attr_reader accessors for any variables your
   templates need access to.
5. Run unit tests.
6. Add usage information in the USAGE file.
7. Update your Manifest.txt with the new files  (if you are using Hoe)
8. Build and install your RubyGem locally. Run: rake install_gem
9. Go to a work area for your scope (e.g. go to the root folder of a Rails application 
   to use a "rails" scoped generator)
10. Run "script/generate" and your generator should appear in the list of available generators.
11. Run "script/generate mygen" to see the options and usage information for your generator.
12. Run "script/generator mygen arguments" to execute the generator.

You will see this message again when you run the generator and by using the -h/--help option.

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rubigen-1.5.8 rubygems_generators/component_generator/USAGE
rubigen-1.5.7 rubygems_generators/component_generator/USAGE
rubigen-1.5.6 rubygems_generators/component_generator/USAGE
rubigen-1.5.5 rubygems_generators/component_generator/USAGE
rubigen-1.5.4 rubygems_generators/component_generator/USAGE
rubigen-1.5.3 rubygems_generators/component_generator/USAGE
rubigen-1.5.0 rubygems_generators/component_generator/USAGE
rubigen-1.5.1 rubygems_generators/component_generator/USAGE
rubigen-1.5.2 rubygems_generators/component_generator/USAGE