This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass at getting bundler to play well when $GEM_HOME is owned by…
… root
- Loading branch information
Carl Lerche
committed
May 24, 2010
1 parent
86240f5
commit 32a2eb2
Showing
7 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module Spec | ||
module Sudo | ||
def self.sudo? | ||
@which_sudo ||= `which sudo`.strip | ||
@which_sudo.any? | ||
end | ||
|
||
module Describe | ||
def describe_sudo(*args, &blk) | ||
return unless Sudo.sudo? | ||
describe(*args) do | ||
before :each do | ||
chown_system_gems | ||
end | ||
|
||
instance_eval(&blk) | ||
end | ||
end | ||
end | ||
|
||
def self.included(klass) | ||
klass.extend Describe | ||
end | ||
|
||
def sudo? | ||
Sudo.sudo? | ||
end | ||
|
||
def sudo(cmd) | ||
cmd = "sudo #{cmd}" if sudo? | ||
sys_exec(cmd) | ||
end | ||
|
||
def chown_system_gems | ||
sudo "chown -R root #{system_gem_path}" | ||
end | ||
end | ||
end |