1

我正在为 Redmine 2.0 和插件的“init.rb”中的以下行构建一个插件

require 'ice_cube'

即使安装了 'ice_cube' 并在我执行 'gem list' 时显示我也会收到加载错误 我使用 rvm 和 ruby​​ 1.9.3p0(2011-10-30 修订版 33570)[x86_64-darwin11.2.0]

这是错误日志:

/Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- ice_cube (LoadError)
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
    from /Users/myth/Learn/Code/Berkman GSOC 2012/Berkman/redmine/plugins/redmine_asset_tracker/init.rb:2:in `<top (required)>'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
    from /Users/myth/Learn/Code/Berkman GSOC 2012/Berkman/redmine/lib/redmine/plugin.rb:129:in `block in load'
    from /Users/myth/Learn/Code/Berkman GSOC 2012/Berkman/redmine/lib/redmine/plugin.rb:120:in `each'
    from /Users/myth/Learn/Code/Berkman GSOC 2012/Berkman/redmine/lib/redmine/plugin.rb:120:in `load'
    from /Users/myth/Learn/Code/Berkman GSOC 2012/Berkman/redmine/config/initializers/30-redmine.rb:13:in `<top (required)>'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `block in load'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/engine.rb:587:in `each'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/engine.rb:587:in `block in <class:Engine>'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/myth/Learn/Code/Berkman GSOC 2012/Berkman/redmine/config/environment.rb:14:in `<top (required)>'
    from /Users/myth/Learn/Code/Berkman GSOC 2012/Berkman/redmine/config.ru:4:in `require'
    from /Users/myth/Learn/Code/Berkman GSOC 2012/Berkman/redmine/config.ru:4:in `block in <main>'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
    from /Users/myth/Learn/Code/Berkman GSOC 2012/Berkman/redmine/config.ru:1:in `new'
    from /Users/myth/Learn/Code/Berkman GSOC 2012/Berkman/redmine/config.ru:1:in `<main>'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/commands/server.rb:46:in `app'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
    from /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
4

1 回答 1

2

我找到了解决问题的方法:

在您的插件目录中添加一个“Gemfile”,其中包含所有列出的 gem,点击“bundle”,然后 require 可以完美运行。

于 2012-06-26T20:18:59.790 回答