lib/itamae/plugin/recipe/rbenv/install.rb in itamae-plugin-recipe-rbenv-0.6.2 vs lib/itamae/plugin/recipe/rbenv/install.rb in itamae-plugin-recipe-rbenv-0.6.3
- old
+ new
@@ -31,29 +31,37 @@
end
end
end
if node[:'rbenv-default-gems'] && node[:'rbenv-default-gems'][:'default-gems']
+ rbenv_plugin 'rbenv-default-gems'
+
node[:'rbenv-default-gems'][:install] = true
file "#{rbenv_root}/default-gems" do
content node[:'rbenv-default-gems'][:'default-gems'].join("\n") + "\n"
mode '664'
- user node[:rbenv][:user] if node[:rbenv][:user]
+ if node[:rbenv][:user]
+ owner node[:rbenv][:user]
+ group node[:rbenv][:group] || node[:rbenv][:user]
+ end
end
end
rbenv_plugin 'ruby-build'
-rbenv_plugin 'rbenv-default-gems'
rbenv_init = <<-EOS
export RBENV_ROOT=#{rbenv_root}
export PATH="#{rbenv_root}/bin:${PATH}"
eval "$(rbenv init --no-rehash -)"
EOS
+build_envs = node[:'ruby-build'][:build_envs].map do |key, value|
+ %Q[export #{key}="#{value}"\n]
+end.join
+
node[:rbenv][:versions].each do |version|
execute "rbenv install #{version}" do
- command "#{rbenv_init} rbenv install #{version}"
+ command "#{rbenv_init} #{build_envs} rbenv install #{version}"
not_if "#{rbenv_init} rbenv versions | grep #{version}"
user node[:rbenv][:user] if node[:rbenv][:user]
end
end