Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions providers/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
include Chef::Mixin::Rbenv

action :install do
if !new_resource.force && ruby_version_installed?(new_resource.name)
ruby_name = ::File.basename(new_resource.name)

if !new_resource.force && ruby_version_installed?(ruby_name)
Chef::Log.debug "rbenv_ruby[#{new_resource.name}] is already installed so skipping"
else
Chef::Log.info "rbenv_ruby[#{new_resource.name}] is building, this may take a while..."
Expand All @@ -45,16 +47,16 @@
}

unless Chef::Platform.windows?
shell_out("chmod -R 0775 versions/#{new_resource.name}", chmod_options)
shell_out("find versions/#{new_resource.name} -type d -exec chmod +s {} \\;", chmod_options)
shell_out("chmod -R 0775 versions/#{ruby_name}", chmod_options)
shell_out("find versions/#{ruby_name} -type d -exec chmod +s {} \\;", chmod_options)
end

new_resource.updated_by_last_action(true)
end

if new_resource.global && !rbenv_global_version?(new_resource.name)
Chef::Log.info "Setting #{new_resource.name} as the rbenv global version"
out = rbenv_command("global #{new_resource.name}")
if new_resource.global && !rbenv_global_version?(ruby_name)
Chef::Log.info "Setting #{ruby_name} as the rbenv global version"
out = rbenv_command("global #{ruby_name}")
unless out.exitstatus == 0
raise Chef::Exceptions::ShellCommandFailed, "\n" + out.format_for_exception
end
Expand Down