我正在尝试将其安装为插件:
https://github.com/phatworx/rack_ip_restrictor
所以我跑:
$ rails plugin install git://github.com/phatworx/rack_ip_restrictor.git
此错误:
/Users/userme/.rvm/gems/ruby-1.9.2-p180@andyw/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/ruby-1.9.2-p180@andyw/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
from /Users/userme/.rvm/gems/ruby-1.9.2-p180@andyw/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `block in require'
from /Users/userme/.rvm/gems/ruby-1.9.2-p180@andyw/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /Users/userme/.rvm/gems/ruby-1.9.2-p180@andyw/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Users/userme/.rvm/gems/ruby-1.9.2-p180@andyw/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/userme/.rvm/gems/ruby-1.9.2-p180@andyw/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
from /Users/userme/.rvm/gems/ruby-1.9.2-p180@andyw/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 :(得分:2)
答案 1 :(得分:1)
@acconrad是正确的。具体的解决方案是(如果你使用rails 3.0.9-使用rake 0.9.2,你应该在需要'rake'之后添加包含Rake :: DSL到Rakefile。 然后添加模块命令;在需要'rails / commands'之前结束脚本/ rails,你将不再得到'命令不是模块(TypeError)'错误信息。):
1.in Rakefile,
require File.expand_path('../config/application', __FILE__)
require 'rake'
# add this line of code
include Rake::DSL
2.in script / rails:
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.然后运行此命令:
$ bundle exec rails plugin install git://github.com/sbecker/asset_packager.git
将安装该插件。
答案 2 :(得分:0)
您是否尝试过使用rails 3.0.10。它实际上应该与3.0.10一起使用!