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
13 changes: 11 additions & 2 deletions lib/roundsman/capistrano.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ def roundsman_working_dir(*path)
end

def sudo(command, *args)
run "#{top.sudo} #{command}", *args
envvars = (self[:default_environment] || {}).collect{|k, v| "#{k}=#{v}"}
if envvars
run "#{top.sudo} env #{envvars.join(" ")} #{command}", *args
else
run "#{top.sudo} #{command}", *args
end
end

def run(*args)
Expand Down Expand Up @@ -190,10 +195,14 @@ def ensure_supported_distro

desc "Installs chef"
task :install, :except => { :no_release => true } do
if self[:rvm_type] == :user
if self[:rvm_type] == :user or self[:rbenv_path]
run "gem uninstall -xaI chef || true"
run "gem install chef -v #{fetch(:chef_version).inspect} --quiet --no-ri --no-rdoc"
run "gem install ruby-shadow --quiet --no-ri --no-rdoc"

if self[:rbenv_path]
run "rbenv rehash"
end
else
sudo "gem uninstall -xaI chef || true"
sudo "gem install chef -v #{fetch(:chef_version).inspect} --quiet --no-ri --no-rdoc"
Expand Down