samvera-deprecated / hydra

Project Hydra Stack Dependencies
Other
83 stars 30 forks source link

(hydra-6.0.0.rc2) Thor error when running hydra generator: `invoke_command': undefined method `name' for nil:NilClass (NoMethodError) #5

Closed flyingzumwalt closed 11 years ago

flyingzumwalt commented 11 years ago

In the Gemfile ''' gem "hydra", "6.0.0.rc2" gem "blacklight" '''

In terminal: ''' ~/Develop/ruby/hydra-tutorials master: rails generate hydra:head -f force app/controllers/catalog_controller.rb create config/initializers/hydra_config.rb insert config/initializers/hydra_config.rb create config/initializers/action_dispatch_http_upload_monkey_patch.rb create config/role_map_cucumber.yml create config/role_map_development.yml create config/role_map_production.yml create config/role_map_test.yml /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/active-fedora-6.0.0/lib/generators/active_fedora/config/solr/solr_generator.rb:4: Use RbConfig instead of obsolete and deprecated Config. /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:118:in invoke_command': undefined methodname' for nil:NilClass (NoMethodError) from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/group.rb:231:in dispatch' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:109:ininvoke' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/active-fedora-6.0.0/lib/generators/active_fedora/config/config_generator.rb:6:in generate' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/command.rb:27:inrun' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:120:in invoke_command' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:inblock in invoke_all' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:in each' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:inmap' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:in invoke_all' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/group.rb:233:indispatch' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:109:in invoke' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/hydra-core-6.0.0/lib/generators/hydra/head_generator.rb:47:increate_configuration_files' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/command.rb:27:in run' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:120:ininvoke_command' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:in block in invoke_all' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:ineach' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:in map' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:ininvoke_all' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/group.rb:233:in dispatch' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/base.rb:439:instart' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/generators.rb:171:in invoke' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/commands/generate.rb:12:in<top (required)>' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in require' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:inblock in require' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in load_dependency' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:inrequire' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/commands.rb:29:in <top (required)>' from script/rails:6:inrequire' from script/rails:6:in `

' '''

jcoyne commented 11 years ago

I am able to duplicate this.

On Sat, Apr 6, 2013 at 10:22 AM, flyingzumwalt notifications@github.comwrote:

In the Gemfile ''' gem "hydra", "6.0.0.rc2" gem "blacklight" '''

In terminal: ''' ~/Develop/ruby/hydra-tutorials master: rails generate hydra:head -f force app/controllers/catalog_controller.rb create config/initializers/hydra_config.rb insert config/initializers/hydra_config.rb create config/initializers/action_dispatch_http_upload_monkey_patch.rb create config/role_map_cucumber.yml create config/role_map_development.yml create config/role_map_production.yml create config/role_map_test.yml /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/active-fedora-6.0.0/lib/generators/active_fedora/config/solr/solr_generator.rb:4: Use RbConfig instead of obsolete and deprecated Config. /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:118:in invoke_command': undefined methodname' for nil:NilClass (NoMethodError) from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/group.rb:231:in dispatch' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:109:in invoke' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/active-fedora-6.0.0/lib/generators/active_fedora/config/config_generator.rb:6:in generate' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/command.rb:27:in run' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:120:in invoke_command' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:inblock in invoke_all' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:in each' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:in map' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:in invoke_all' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/group.rb:233:in dispatch' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:109:in invoke' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/hydra-core-6.0.0/lib/generators/hydra/head_generator.rb:47:in create_configuration_files' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/command.rb:27:in run' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:120:in invoke_command' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:in block in invoke_all' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:in each' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:in map' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:127:in invoke_all' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/group.rb:233:in dispatch' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/base.rb:439:in start' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/generators.rb:171:in invoke' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/commands/generate.rb:12:in ' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in require' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:inblock in require' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in load_dependency' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in require' from /Users/matt/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/commands.rb:29:in <top (required)>' from script/rails:6:inrequire' from script/rails:6:in `' '''

— Reply to this email directly or view it on GitHubhttps://github.com/projecthydra/hydra/issues/5 .

jcoyne commented 11 years ago

This problem does not occur if you use hydra-head instead of hydra in the gemfile.

jeremyf commented 11 years ago

I'm wondering if this is a matter of including explicit requires for the underlying hydra related gems?

jcoyne commented 11 years ago

Is this because having hydra in your gemfile never requires the hydra-head gem?

jcoyne commented 11 years ago

@jeremyf I don't think it'll be that easy, since https://github.com/projecthydra/hydra-head/blob/master/hydra-core/lib/hydra-core.rb#L1 does require 'hydra' which it expects to be this file: https://github.com/projecthydra/hydra-head/blob/master/hydra-core/lib/hydra.rb

But you've defined that module already in the hydra gem itself.

flyingzumwalt commented 11 years ago

Related: before getting this error, I got "Blacklight not defined" when my gentile just listed hydra without listing bl.

On Apr 6, 2013, at 10:55 AM, Justin Coyne notifications@github.com wrote:

@jeremyf https://github.com/jeremyf I don't think it'll be that easy, since https://github.com/projecthydra/hydra-head/blob/master/hydra-core/lib/hydra-core.rb#L1does require 'hydra' which it expects to be this file: https://github.com/projecthydra/hydra-head/blob/master/hydra-core/lib/hydra.rb

But you've defined that module already in the hydra gem itself.

— Reply to this email directly or view it on GitHubhttps://github.com/projecthydra/hydra/issues/5#issuecomment-15998537 .

jeremyf commented 11 years ago

I created a new project, with Gemfile:

gem 'hydra', path: '../hydra'
gem 'blacklight'

And the only error I got was one related to app/models/user.rb being expected. (Ruby 1.9.3)

cbeer commented 11 years ago

This is exactly what SimonLamb reported in IRC last week. Rails (Ruby? Bundler?) doesn't auto-require second-order dependencies.

jeremyf commented 11 years ago

I'm switching to Ruby 2.0.0 to see if I can duplicate the problem, because if I can't, then I really don't stand a chance of fixing this.

jeremyf commented 11 years ago

If I use :path as a gem option, I can't duplicate. If I use the rc2 I can. Obviously :path is not a good solution.

jeremyf commented 11 years ago

I just minted 6.0.0.rc3, you shouldn't need the explicit blacklight declaration.

I successfully ran rails generate hydra:head -f from command line. To tweak get it to work locally, I used my hydra repo, tweaked the code then ran rake build && rake install, and switched over to my dummy hydra-head and ran bundle with a Gemfile of

source 'https://rubygems.org'

gem 'hydra', '6.0.0.rc3'
gem 'sqlite3'

followed by rails generate hydra:head -f.

jcoyne commented 11 years ago

When I upgraded to rc3, the generator does pass. However, when you start the server rails s I get this error:

/Users/justin/workspace/minnebar/app/models/user.rb:3:in `<class:User>': uninitialized constant Hydra::User (NameError)
    from /Users/justin/workspace/minnebar/app/models/user.rb:1:in `<top (required)>'
jeremyf commented 11 years ago

Try hydra 6.0.0.rc6