Project

General

Profile

(NoMethodError) error when including LiquidPlanner gem in Redmine

Added by Diya John over 13 years ago

I am working on developing a Redmine plugin to update tasks / projects in Liquidplanner. I am using the liquidplanner gem. When I include this gem in the redmine plugin, I get the following error

rubygems.rb:223:in `activate': You have a nil object when you didn't expect it! (NoMethodError)
You might have expected an instance of Array.
The error occurred while evaluating nil.map
from rubygems.rb:249:in `activate'
from rubygems/custom_require.rb:35:in `require'
.....
from redmine/config/environment.rb:20
from rubygems/custom_require.rb:31:in `gem_original_require'
from redmine/vendor/rails/railties/lib/commands/server.rb:84
from rubygems/custom_require.rb:31:in `gem_original_require'
from script/server:3

I am using
Ruby -> 1.8.7
Redmine -> 1.0.1
rubygems -> 1.3.7
on windows

Here is what I did.. I added a plugin in Redmine (just one hook file inside lib folder ) modified the init.rb file inside the plugin to include the hook file

In the hook file added the following code

require 'rubygems'
require 'liquidplanner' *--> including this line causes the error*
lp = LiquidPlanner::Base.new(:email=>'my_email', :password=>'my_password')
workspace = lp.workspaces(my_space_id)

The gem works when I execute it independently.
Any idea why this is happening?

Thanks for your time!


Replies (3)

RE: (NoMethodError) error when including LiquidPlanner gem in Redmine - Added by Felix Schäfer over 13 years ago

Can you post the whole error stack? This looks like a bug of either rubygems not including the gem correctly or the gem not responding correctly to this inclusion though...

RE: (NoMethodError) error when including LiquidPlanner gem in Redmine - Added by Diya John over 13 years ago

This is what I get

E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:223:in `activate': You have a nil object when you didn't expect it! (NoMethodError)
You might have expected an instance of Array.
The error occurred while evaluating nil.map
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:249:in `activate'
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `each'
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `activate'
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:35:in `require'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from E:/Ruby187/projects/redmine/vendor/plugins/redmine_liquidplanner/lib/lp.rb:2
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from E:/Ruby187/projects/redmine/vendor/plugins/redmine_liquidplanner/lib/issues_hook.rb:1
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:380:in `load_without_new_constant_marking
'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:380:in `load_file'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:379:in `load_file'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:259:in `require_or_load'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:224:in `depend_on'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:136:in `require_dependency'
from E:/Ruby187/projects/redmine/vendor/plugins/redmine_liquidplanner/init.rb:2:in `evaluate_init_rb'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:158:in `evaluate_init_rb'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:154:in `evaluate_init_rb'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:48:in `load'
from E:/Ruby187/projects/redmine/config/../vendor/plugins/engines/lib/engines/plugin.rb:44:in `load'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:38:in `load_plugins'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:37:in `each'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:37:in `load_plugins'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:369:in `load_plugins'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:165:in `process'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
from E:/Ruby187/projects/redmine/config/environment.rb:20
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from E:/Ruby187/projects/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from E:/Ruby187/projects/redmine/vendor/rails/railties/lib/commands/server.rb:84
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3

The following ruby script works when executed separately
require 'rubygems'
require 'liquidplanner'
lp = LiquidPlanner::Base.new(:email=>'my_email', :password=>'my_password')
workspace = lp.workspaces(my_space_id)
puts workspace

So I guess the gem not responding correctly to this inclusion.....

RE: (NoMethodError) error when including LiquidPlanner gem in Redmine - Added by Felix Schäfer over 13 years ago

Mmh, maybe you could drop by the IRC channel and ask edavis10, or maybe even meineerde, I think they have a little more insight in those matters and they might be able to help you.

    (1-3/3)