lib/itamae/plugin/recipe/rbenv/install.rb in itamae-plugin-recipe-rbenv-0.6.8 vs lib/itamae/plugin/recipe/rbenv/install.rb in itamae-plugin-recipe-rbenv-0.6.9

- old
+ new

@@ -20,24 +20,28 @@ directory File.join(rbenv_root, 'cache') do user node[:rbenv][:user] if node[:rbenv][:user] end end -define :rbenv_plugin do +define :rbenv_plugin, group: 'rbenv', revision: nil do name = params[:name] + group = params[:group] + rev = params[:revision] if node[name] && (node[name][:install] || node[name][:revision]) git "#{rbenv_root}/plugins/#{name}" do - repository "#{scheme}://github.com/rbenv/#{name}.git" - revision node[name][:revision] if node[name][:revision] + repository "#{scheme}://github.com/#{group}/#{name}.git" + revision rev if rev user node[:rbenv][:user] if node[:rbenv][:user] end end end if node[:'rbenv-default-gems'] && node[:'rbenv-default-gems'][:'default-gems'] - rbenv_plugin 'rbenv-default-gems' + rbenv_plugin 'rbenv-default-gems' do + revision node[:'rbenv-default-gems'][:revision] + end node[:'rbenv-default-gems'][:install] = true file "#{rbenv_root}/default-gems" do content node[:'rbenv-default-gems'][:'default-gems'].join("\n") + "\n" mode '664' @@ -46,11 +50,13 @@ group node[:rbenv][:group] || node[:rbenv][:user] end end end -rbenv_plugin 'ruby-build' +rbenv_plugin 'ruby-build' do + revision node[:'ruby-build'][:revision] +end rbenv_init = <<-EOS export RBENV_ROOT=#{rbenv_root} export PATH="#{rbenv_root}/bin:${PATH}" eval "$(rbenv init --no-rehash -)" @@ -73,7 +79,20 @@ execute "rbenv global #{version}" do command "#{rbenv_init} rbenv global #{version}" not_if "#{rbenv_init} rbenv version --bare | grep -x #{version}" user node[:rbenv][:user] if node[:rbenv][:user] end + end +end + +node[:rbenv][:plugins].each do |name, options| + if name.include?('/') + owner, repo = spec.split('/', 2) + else + owner, repo = 'rbenv', name + end + + rbenv_plugin repo do + group owner + revision options[:revision] end end