Skip to content

A rails generator that generates a rails generator skeleton for easy creation of new rails generators. Like plugin generator but with generators.

Notifications You must be signed in to change notification settings

spejman/rails-generator-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Rails Generator Generator
=============

A rails generator that generates a rails generator skeleton for easy creation of new 
rails generators.
Like plugin generator but with generators.

You can install it as a gem or copying the code into vendor/generators:
  mkdir vendor/generators
  cd vendor/generators
  git clone git://github.com/spejman/rails-generator-generator.git

Usage
========
NAME
     generator - creates a generator

SYNOPSIS
     generator [Generator name] [<default>|base|named]
     
     Good names are Login ModelRelation CommonMigration.
     Generator type argument is optional, posible values are base (will generate
     a  Rails::Generator::Base) or named (will generate a Rails::Generator::NamedBase).
     By default type argument is named.

DESCRIPTION
     This generator creates a generator skeleton.

            
EXAMPLE
      ./script/generate generator Login

     This will generate an generator with name login (login_generator). 

HOWTO Install a generator
================================

When you create your generator with rails generator generator, it installs it at vendor/generators.

In order to make rails take notice of the generator you have 3 options:
 1) Keep it at vendor/generators.
 2) Copy it into the a subir called generators in one plugins.
 3) Create a gem whose name finishes with "_generator".

Example: example_generator with 3 files example_generator.rb, USAGE and example_template.rb.
1) 
    RAILS_ROOT/vendor/generators/example_generator/example_generator.rb
    RAILS_ROOT/vendor/generators/example_generator/USAGE
    RAILS_ROOT/vendor/generators/example_generator/templates/example_template.rb

2)
    RAILS_ROOT/vendor/plugins/PLUGIN_NAME/generators/example_generator/example_generator.rb
    RAILS_ROOT/vendor/plugins/PLUGIN_NAME/generators/example_generator/USAGE
    RAILS_ROOT/vendor/plugins/PLUGIN_NAME/generators/example_generator/templates/example_template.rb

3) Into the root of the gem called example_generator (notice that the name ends with "_generator"):
    example_generator.rb
    USAGE
    templates/example_template.rb

Credits
=======

Created by Sergio Espeja
http://www.sergioespeja.com
http://spejman.blogspot.com (spanish blog)
http://spejman-on-rails.blogspot.com (english blog)

About

A rails generator that generates a rails generator skeleton for easy creation of new rails generators. Like plugin generator but with generators.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages