Permalink
Browse files

Merge pull request #22 from tk0miya/cooperate-with-rvm-capistrano

Support ruby installed by RVM on user-land (cooperate with rvm-capistrano)
  • Loading branch information...
2 parents 9fcd6d6 + 41a510a commit ffdfc12a946339693fda73fa17c17f4ec0c34de0 @Arie Arie committed Feb 7, 2013
Showing with 15 additions and 3 deletions.
  1. +15 −3 lib/roundsman/capistrano.rb
@@ -195,15 +195,27 @@ def ensure_supported_distro
desc "Installs chef"
task :install, :except => { :no_release => true } do
- sudo "gem uninstall -xaI chef || true"
- sudo "gem install chef -v #{fetch(:chef_version).inspect} --quiet --no-ri --no-rdoc"
- sudo "gem install ruby-shadow --quiet --no-ri --no-rdoc"
+ if rvm_type == :user
+ 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"
+ else
+ sudo "gem uninstall -xaI chef || true"
+ sudo "gem install chef -v #{fetch(:chef_version).inspect} --quiet --no-ri --no-rdoc"
+ sudo "gem install ruby-shadow --quiet --no-ri --no-rdoc"
+ end
end
desc "Runs the existing chef configuration"
task :chef_solo, :except => { :no_release => true } do
logger.info "Now running #{fetch(:run_list).join(', ')}"
+ if rvm_type == :user
+ old_sudo = self[:sudo]
+ self[:sudo] = "rvmsudo_secure_path=1 #{File.join(rvm_bin_path, "rvmsudo")}"
+ end
+
sudo "chef-solo -c #{roundsman_working_dir("solo.rb")} -j #{roundsman_working_dir("solo.json")}#{' -l debug' if fetch(:debug_chef)}"
+ self[:sudo] = old_sudo
end
def ensure_cookbooks_exists

0 comments on commit ffdfc12

Please sign in to comment.