I’m running Ruby 1.9.2 and Rails 3.0.0 in WinXP. I ran gem install nifty-generators from inside a new project directory. It said the gem, version 0.4.2, was successfully installed but there was an error installing ri and rdoc, so I ran the same command again but with the –no-ri –no-rdoc switches. Now it appears nifty_generators is installed with no errors, and it shows up in my gem list, but when I run rails g nifty:layout it says the nifty:layout generator wasn’t found. rails g nifty_layout also doesn’t work. Anyone has ideas? Thanks!
EDIT: Outputs as requested:
C:\Documents\Prgm>ruby -v
ruby 1.9.2p0 (2010-08-18) [i386-mingw32]
I’m running XP, so don’t have which, but ruby.exe is in C:\Ruby192\bin.
C:\Documents\Prgm>gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby192/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: C:/Ruby192/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby192/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/Ruby192/lib/ruby/gems/1.9.1
- C:/Documents and Settings/Linh/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
C:\Prgm\Survey_Manager>rails generate
Usage: rails generate GENERATOR [args] [options]
General options:
-h, [--help] # Print generator's options and usage
-p, [--pretend] # Run but do not make any changes
-f, [--force] # Overwrite files that already exist
-s, [--skip] # Skip files that already exist
-q, [--quiet] # Suppress status output
Please choose a generator below.
Rails:
controller
generator
helper
integration_test
mailer
migration
model
observer
performance_test
plugin
resource
scaffold
scaffold_controller
session_migration
stylesheets
Also, rails g is shorthand for rails generate in Rails 3. See e.g. here: http://railscasts.com/episodes/216-generators-in-rails-3.
I have almost the same configuration as you, @Anita (win XP, rails 3 and ruby 1.9.3), and
rails g nifty:layoutworks pretty well for me.Make sure that you’re running
rails gcommand from the root directory of your app (i.e. from the directory whereGemfileis located). Also, make sure that yourGemfilecontains this line:gem 'nifty-generators'.