Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

first commit!

  • Loading branch information...
commit a1228a12111b3ff715d7dc43e84c8d5d3a3c02c3 0 parents
@jugyo authored
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!
Please sign in to comment.
Something went wrong with that request. Please try again.