berks拒绝更新

时间:2014-11-08 14:53:29

标签: ruby berkshelf

我可以安装berkshelf就好了:

$ gem install berkshelf                                                                     
Successfully installed berkshelf-3.2.0
Parsing documentation for berkshelf-3.2.0
Done installing documentation for berkshelf after 1 seconds
1 gem installed

但它实际上没有影响我的berks:

$ berks version
Berkshelf (2.0.18)

看似正常:

$ which berks
/home/rubyUser/.rvm/gems/ruby-2.1.4/bin/berks

我在debian stable(wheezy)上使用ruby 2.1.4:

$ rvm list

rvm rubies

   ruby-1.9.3-p550 [ x86_64 ]
=* ruby-2.1.4 [ x86_64 ]

我认为我的道路是正确的:

$ echo $PATH
/home/rubyUser/.rvm/gems/ruby-2.1.4/bin:/home/rubyUser/.rvm/gems/ruby-2.1.4@global/bin:/home/rubyUser/.rvm/rubies/ruby-2.1.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/rubyUser/.rvm/bin:/home/rubyUser/.rvm/bin

chefdk可能会以某种方式干扰:

$ whereis berks
berks: /usr/bin/berks /usr/bin/X11/berks /opt/chefdk/bin/berk

b给出调用berks的完整路径不会影响版本。看看which提供的那些berks显示它只是从别处召唤宝石,我该如何追捕它来自哪里?

$ cat `which berks`
#!/usr/bin/env ruby_executable_hooks
#
# This file was generated by RubyGems.
#
# The application 'berkshelf' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first
  str = ARGV.first
  str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
  if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
    version = $1
    ARGV.shift
  end
end

gem 'berkshelf', version
load Gem.bin_path('berkshelf', 'berks', version)

1 个答案:

答案 0 :(得分:0)

我在我所在的目录中有一个错误的Gemfile.lock。它将berkshelf锁定到2.0版本。

我的问题更深层次的答案是获得一个正确的Rakefile,以便在必要时正确清理这些东西