Skip to content

Commit

Permalink
Revert "use rvmsudo when available"
Browse files Browse the repository at this point in the history
This reverts commit bb63504.

Unfortunatly gem_package can't find gems it installs when
running under rvmsudo. In search of a New Plan.
  • Loading branch information
Matthew Kocher committed Apr 6, 2013
1 parent f636741 commit 63676af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 27 deletions.
7 changes: 1 addition & 6 deletions lib/soloist/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,13 @@ def debug?

private
def conditional_sudo(command)
sudo_command = rvm? ? "rvmsudo_secure_path=1 rvmsudo" : "sudo"
root? ? command : "#{sudo_command} -E #{command}"
root? ? command : "sudo -E #{command}"
end

def root?
Process.uid == 0
end

def rvm?
`which rvm`.length > 0
end

def royal_crown_cookbooks_directory
File.expand_path("cookbooks", royal_crown_path)
end
Expand Down
25 changes: 4 additions & 21 deletions spec/lib/soloist/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,28 +92,11 @@
end

context "when the user is not root" do
context "when rvm is not present" do
before do
cli.soloist_config.stub(:rvm?).and_return(false)
end
it "creates the cache path using sudo" do
cli.soloist_config.should_receive(:exec) do |command|
command.should =~ /^sudo -E/
end
cli.chef
end
end

context "when rvm is present" do
before do
cli.soloist_config.stub(:rvm?).and_return(true)
end
it "creates the cache path using rvmsudo" do
cli.soloist_config.should_receive(:exec) do |command|
command.should =~ /rvmsudo -E/
end
cli.chef
it "creates the cache path using sudo" do
cli.soloist_config.should_receive(:exec) do |command|
command.should =~ /^sudo -E/
end
cli.chef
end
end

Expand Down

0 comments on commit 63676af

Please sign in to comment.