2011-08-18 11 views
5

我想安装此作为一个插件:如何安装在导轨3插件,得到一个命令是不是一个模块(类型错误)

https://github.com/phatworx/rack_ip_restrictor 

于是我运行:

$ rails plugin install git://github.com/phatworx/rack_ip_restrictor.git 

这个错误与:

/Users/userme/.rvm/gems/[email protected]/gems/railties-3.0.5/lib/rails/commands/plugin.rb:277:in `<top (required)>': Commands is not a module (TypeError) 
    from /Users/userme/.rvm/gems/[email protected]/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require' 
    from /Users/userme/.rvm/gems/[email protected]/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `block in require' 
    from /Users/userme/.rvm/gems/[email protected]/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `block in load_dependency' 
    from /Users/userme/.rvm/gems/[email protected]/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in `new_constants_in' 
    from /Users/userme/.rvm/gems/[email protected]/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `load_dependency' 
    from /Users/userme/.rvm/gems/[email protected]/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require' 
    from /Users/userme/.rvm/gems/[email protected]/gems/railties-3.0.5/lib/rails/commands.rb:17:in `<top (required)>' 
    from script/rails:6:in `require' 
    from script/rails:6:in `<main>' 

建议,想法?由于

回答

0

你有没有试着用导轨3.0.10。实际上它应该与3.0.10一起工作!

1

@acconrad是正确的。具体的解决方案是(如果你使用rails 3.0.9-与rake 0.9.2,你应该在需要'rake'之后添加Rake :: DSL到Rakefile。 然后添加模块Commands; end在require之前的脚本/ rails '轨道/命令',你不会得到 '命令是不是一个模块(类型错误)' 的错误消息更多):

1.in Rake文件,

require File.expand_path('../config/application', __FILE__) 
require 'rake' 
# add this line of code 
include Rake::DSL 

2.in脚本/导轨:

APP_PATH = File.expand_path('../../config/application', __FILE__) 
require File.expand_path('../../config/boot', __FILE__) 
# add this line of code 
module Commands; end 
require 'rails/commands' 

3.then运行以下命令:

$ bundle exec rails plugin install git://github.com/sbecker/asset_packager.git 

该插件将被安装。

相关问题