3 Creating Generators with Generators doesn't work as written. #8790

Closed
downrightmike opened this Issue Jan 7, 2013 · 3 comments

4 participants

@downrightmike

Hello,
I was going through the generators example http://guides.rubyonrails.org/generators.html , which mentions rails 3.0, I'm using 3.2.10.
$ rails generate generator initializer
Doesn't create:
"create lib/generators/initializer/templates"
or
class InitializerGenerator < Rails::Generators::NamedBase
source_root File.expand_path("../templates", FILE)
end

I'm new, so It may just be me, so I didn't want to just start changing things.
Mike

@steveklabnik
Ruby on Rails member

Can you expand on this, please? Here's what I get:

steve at thoth in ~/tmp/foo on master!
$ rails generate generator initializer
      create  lib/generators/initializer
      create  lib/generators/initializer/initializer_generator.rb
      create  lib/generators/initializer/USAGE
      create  lib/generators/initializer/templates

steve at thoth in ~/tmp/foo on master!
$ cat lib/generators/initializer/initializer_generator.rb 
class InitializerGenerator < Rails::Generators::NamedBase
  source_root File.expand_path('../templates', __FILE__)
end

steve at thoth in ~/tmp/foo on master!
$ rails -v
Rails 3.2.9

Note that it did in fact make lib/generators/initializer/templates.

Can you give me a Rails app where this doesn't happen?

If it doesn't make them, what does it do?

@parndt

Seems stale

@rafaelfranca
Ruby on Rails member

Closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment