2014-05-14 53 views
0

我試圖用廚師以下(Centos的VM)的問題:廚師RVM食譜 - 與訪問安裝寶石

  • 安裝Ruby 1.9.3
  • 創建一個寶石(「廚師測試」 )這是提供給任何人
  • 上的「廚師測試」安裝兩種寶石(rubocop和foodcritic)寶石
我使用 https://github.com/fnichol/chef-rvm

從包裝食譜中安裝RVM。

這裏是我的食譜的部分,它覆蓋RVM食譜和理論上應該可以在上面做:

node.override['rvm']['default_ruby'] = '[email protected]' 
node.override[:rvm][:rubies] = [ '[email protected]' ] 
node.override['rvm']['group_users'] = [ 'teamcity' ] 

node.override['rvm']['gems'] = { 
    '[email protected]' => [ 
    { 'name' => 'rubocop', 
     'version' => '0.19.1' 
    }, 
    { 'name' => 'foodcritic'} 
    ] 
} 

include_recipe 'rvm::system' 

廚師匯聚完成時沒有錯誤,但是當我登錄爲「TeamCity的」用戶和執行其中一個寶石我得到以下內容:

[[email protected] ~]$ rubocop 
/usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/ 
kernel_require.rb:135:in `require': cannot load such file 
-- ruby-progressbar (LoadError) 
from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `rescue in require' 
    from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require' 
    from /usr/local/rvm/gems/[email protected]/gems/rubocop-0.19.1/lib/rubocop/formatter/fuubar_style_formatter.rb:3:in `<top (required)>' 
    from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /usr/local/rvm/gems/[email protected]/gems/rubocop-0.19.1/lib/rubocop.rb:224:in `<top (required)>' 
    from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /usr/local/rvm/gems/[email protected]/gems/rubocop-0.19.1/bin/rubocop:7:in `<top (required)>' 
    from /usr/local/rvm/gems/[email protected]/bin/rubocop:23:in `load' 
    from /usr/local/rvm/gems/[email protected]/bin/rubocop:23:in `<main>' 
    from /usr/local/rvm/gems/[email protected]/bin/ruby_executable_hooks:15:in `eval' 
    from /usr/local/rvm/gems/[email protected]/bin/ruby_executable_hooks:15:in `<main>' 
    -- ruby-progressbar (LoadError) 

我在這裏錯過了什麼?用戶正確添加到rvm組,並且當我以用戶身份登錄時,默認加載正確的gemset。

回答

1

這與Rubocop具有對ruby-progressbar的依賴關係。請參閱https://github.com/jfelchner/ruby-progressbar/issues/73。一個可能的解決方法是更新你的gemfile,使其版本小於< 1.5.0。

更新:現在已經在ruby-progressbar 1.5.1中修復了。

+1

捆綁更新後,我遇到了這個問題。所以我查看了鎖文件中更新的內容,並發現它是ruby-progressbar。 –

+0

有道理。再次感謝。 – keftes