使用Deprecate.skip_during的Ruby未定义方法错误

时间:2011-06-27 08:40:12

标签: ruby module gem

我正在尝试在我的本地计算机上安装Gitorious。但是,当我执行控制台应用程序时出现此错误:

  

/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:194:in   block in stub_source_index170': undefined method skip_during'for   捆绑:: RubygemsIntegration ::弃用:类   (NoMethodError)

在/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb中执行的ruby代码是:

def stub_source_index170(specs)
      Gem::SourceIndex.send(:define_method, :initialize) do |*args|
        @gems = {}
        # You're looking at this thinking: Oh! This is how I make those
        # rubygems deprecations go away!
        #
        # You'd be correct BUT using of this method in production code
        # must be approved by the rubygems team itself!
        #
        # This is your warning. If you use this and don't have approval
        # we can't protect you.
        #
        Deprecate.skip_during do
          self.spec_dirs = *args
          add_specs(*specs)
        end
      end
    end

我猜错误的发生是因为没有加载弃用模块或类似的东西......我不知道ruby ......但是我怎样才能尝试纠正它?

我有宝石1.8.1

的红宝石1.9.1p431(2011-02-18修订版30908)

宝石清单:

  

*本地宝石*

     

actionmailer(2.3.5)actionpack   (2.3.5)activerecord(2.3.8,2.3.5)   activeresource(2.3.5)activesupport   (2.3.8,2.3.5)作为可标记的行为   (2.0.6)builder(3.0.0)bundler   (1.0.15)慢性(0.3.0)   daemon_controller(0.2.6)守护进程   (1.1.0)diff-lcs(1.1.2)echoe(4.3.1)   eventmachine(0.12.10)   exception_notification(1.0.20090728)   factory_girl(1.3.3)fastthread   (1.0.7)gemcutter(0.6.1)geoip   (0.8.9)hoe(2.8.0)json_pure(1.5.0)   mime-types(1.16)mocha(0.9.10)mysql   (2.8.1)oauth(0.4.4)回形针   (2.2.9.2)乘客(3.0.7)   proxymachine(1.2.4)rack(1.0.1)   rails(2.3.5)rake(0.8.7)rdiscount   (1.3.1.1)revo-ssl_requirement(1.1.0)   谜语(1.2.2)rmagick(2.13.1)   ruby-hmac(0.4.0)ruby-openid(2.1.8)   ruby-yadis(0.3.4)rubyforge(2.0.4)   shoulda(2.9.2)state_machine(0.9.4)   stomp(1.1)stompserver(0.9.9)tuxml   (0.0.1)validates_url_format_of   (0.1.1)will_paginate(2.3.15)

非常感谢提前。

卡洛斯。

2 个答案:

答案 0 :(得分:2)

较新版本的Rubygems正在弃用一些旧的内部方法。您可以使用gem update --system 1.x.y(例如1.5.2)降级Rubygems,看看是否能解决您的问题。

答案 1 :(得分:0)

Deprecate被命名为Gem :: Deprecate。你可以临时修补它:

Gem::Deprecate.skip_during do
  self.spec_dirs = *args
  add_specs(*specs)
end