Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Gem generators are not found by script/generate

#3774

cucumber generators are installed but script/generate does not find them

marc@marc-desktop:~/wk/new_app$ script/generate cucumber
Could not find generator cucumber.
marc@marc-desktop:~/wk/new_app$ script/generate
Usage:
script/generate GENERATOR [args] [options]

General options:
-h, [--help] # Print generators 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] # Supress status output

Please choose a generator below.

Rails:
app controller generator helper integration_test mailer metal migration model model_subclass observer performance_test plugin resource scaffold scaffold_controller session_migration stylesheets

ActiveRecord:
active_record:migration active_record:model active_record:observer active_record:session_migration

Erb:
erb:controller erb:mailer erb:scaffold

TestUnit:
test_unit:controller test_unit:helper test_unit:integration test_unit:mailer test_unit:model test_unit:observer test_unit:performance test_unit:plugin test_unit:scaffold

marc@marc-desktop:~/wk/new_app$ gem list --local

LOCAL GEMS

actionmailer (2.3.5, 2.3.3)
actionpack (2.3.5, 2.3.3)
activerecord (2.3.5, 2.3.3)
activeresource (2.3.5, 2.3.3)
activesupport (2.3.5, 2.3.3)
builder (2.1.2)
bundler (0.8.1)
chronic (0.2.3)
columnize (0.3.1)
cucumber (0.6.2, 0.6.1)
cucumber-rails (0.2.4, 0.2.3)
database_cleaner (0.4.3, 0.4.0)
diff-lcs (1.1.2)
factory_girl (1.2.3)
gemcutter (0.3.0)
hoe (2.5.0, 2.4.0)
hpricot (0.8.2)
httpclient (2.1.5.2)
json_pure (1.2.0)
linecache (0.43)
mail (1.6.0)
mime-types (1.16)
mysql (2.8.1, 2.7)
nokogiri (1.4.1)
polyglot (0.2.9)
rack (1.1.0, 1.0.0)
rack-test (0.5.3)
rails (2.3.5, 2.3.3)
rake (0.8.7)
rmagick (2.12.2, 2.11.0)
rspec (1.3.0, 1.2.9)
rspec-rails (1.3.2, 1.2.9)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3)
rubyforge (2.0.3)
rvm (0.1.1)
soap4r (1.5.8)
sqlite3-ruby (1.2.5)
term-ansicolor (1.0.4)
timecop (0.3.4)
treetop (1.4.3)
webrat (0.7.0, 0.6.0)
whenever (0.4.1)
will_paginate (2.3.12, 2.3.11)

Reported by marc-donovan · January 23rd, 2010 @ 12:20 AM

State: committed
Milestone: 3.0.2
Assigned to: Yehuda Katz (wycats) Yehuda Katz (wycats)
Importance: Low

Activity

  1. David Chelimsky
    David Chelimsky
    • Assigned user set to Yehuda Katz (wycats)

    Yehuda - this is the same issue we talked about at RailsConf. The rake command and script/rails g script need bundler to load gems in the test group in order for gems like cucumber-rails and rspec-rails to expose tasks and generators via a railtie.

    June 12th, 2010 @ 11:28 AM

  2. David Chelimsky
    David Chelimsky
    • Assigned user changed from Yehuda Katz (wycats) to Carl Lerche

    June 12th, 2010 @ 11:28 AM

  3. David Chelimsky
    David Chelimsky
    • Assigned user changed from Carl Lerche to José Valim

    June 12th, 2010 @ 11:46 AM

  4. José Valim
    José Valim

    Marc, first, you need to add cucumber to your Gemfile. Then, if you add the gem to the group test, you need to run generators in the same group.

    David, I'm going to discuss with Yehuda the issue. Although, unfortunately, I do not have a solution in mind.

    June 12th, 2010 @ 11:49 AM

  5. TMorgan99
    TMorgan99

    Is this a documentation issue?
    users have to be trained to the bundler way.

    June 14th, 2010 @ 11:34 PM

  6. José Valim
    José Valim
    • Milestone cleared.
    • Assigned user changed from José Valim to Yehuda Katz (wycats)

    June 22nd, 2010 @ 06:34 AM

  7. Jason Gignac
    Jason Gignac

    TMorgan - I guess, I would argue that generation isn't something that one thinks of as being specific to a particular environment - I want rails to make some new files for me, and they will exist (whether or not I access them) independent of what environment I am working in, once they are generated. So, to say 'you can only generate a cucumber test inside the test environment' seems counterintuitive - it's like saying I can only generate a model if I'm in the Development environment, and that I'd need to explicitly define that. Intuitively, generators are simply 'there', you know?

    I can understand only loading a particular set of gems for server or console, say, but for generate, my gut would say to load all the gems for all the environments, since the generated files may interact with any environment. But then, of course, you have the issue that there may be conflicting gems in one environment versus another... yeah, that sucks.

    June 24th, 2010 @ 05:29 PM

  8. José Valim
    José Valim
    • State changed from new to committed

    June 26th, 2010 @ 12:00 AM

  9. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Low

    October 15th, 2010 @ 11:01 PM

  10. jasperkennis
    jasperkennis

    I went trough quite a search before I found out that in order to run
    $ rails generate cucumber succesfully, you need to run
    $ rails generate cucumber:install :install

    This might be of topic a bit but does solve the issue initially submitted. Also, this had a milestone for 3.0.2 but I'm experiencing the issue in 3.0.3, and all gems are up to date. That might require some attention.

    January 26th, 2011 @ 01:40 PM