Skip to content
Browse files

first commit!

  • Loading branch information...
0 parents commit a1228a12111b3ff715d7dc43e84c8d5d3a3c02c3 @jugyo committed Feb 21, 2010
Showing with 27 additions and 0 deletions.
  1. +12 −0 README.md
  2. 0 init.rb
  3. +14 −0 lib/generators/foo/foo_generator.rb
  4. +1 −0 lib/generators/foo/templates/foo
12 README.md
@@ -0,0 +1,12 @@
+Sample of rails3 generator
+======
+
+ rails3_generator_sample
+ |-- README.md
+ |-- init.rb
+ `-- lib
+ `-- generators # directory of generators
+ `-- foo # directory of "foo generator"
+ |-- foo_generator.rb # script of "foo generator"
+ `-- templates # directory of templates (specified as "source_root" in foo_generator.rb)
+ `-- foo # foo!
0 init.rb
No changes.
14 lib/generators/foo/foo_generator.rb
@@ -0,0 +1,14 @@
+require 'rails/generators'
+
+class FooGenerator < Rails::Generators::Base
+ def self.source_root
+ @_foo_source_root ||=
+ File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
+ end
+
+ def install
+ copy_file(
+ 'foo'
+ )
+ end
+end
1 lib/generators/foo/templates/foo
@@ -0,0 +1 @@
+foo!

0 comments on commit a1228a1

Please sign in to comment.
Something went wrong with that request. Please try again.