在配置时使用rbenv安装Bundler gem(Chef + Vagrant)

时间:2016-12-07 22:09:42

标签: vagrant chef bundler rbenv

我正在使用Vagrant + Chef为rails开发配置Ubuntu16.04 vm。我想安装Bundler with Chef(使用rbenv),但由于某种原因,它失败并显示以下消息:" undefined method`clear_sources'来自cookbook rbenv"的自定义资源rbenv_gem。

有什么想法吗?

谢谢!

我的Vagrantfile的内容:

Vagrant.configure("2") do |config|

config.vm.box = "bento/ubuntu-16.04"

config.vm.network :forwarded_port, guest: 3000, host: 3000

config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks", "site-cookbooks"]

chef.add_recipe "apt"
chef.add_recipe "ruby_build"
chef.add_recipe "rbenv::user"
chef.add_recipe "rbenv::vagrant"

chef.json = {
  rbenv: {
    user_installs: [{
      user: 'vagrant',
      rubies: ["2.3.1"],
      global: "2.3.1" ,
      gems: {
        "2.3.1" => [
          { name: "bundler" }
        ]
      }
    }]
  }
}
end
end

Cheffile:

site "https://supermarket.getchef.com/api/v1"

cookbook 'apt'
cookbook 'build-essential'
cookbook 'ruby_build', '~> 1.0.0'
cookbook 'rbenv', git: 'https://github.com/aminin/chef-rbenv'

1 个答案:

答案 0 :(得分:0)

您应该使用the official chef-rbenv cookbook,您的问题可能由#110确定。

顺便说一句。没有使用测试厨房的任何特殊原因?