Skip to content

Commit

Permalink
Fix the logic for determining whether or not to use sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Lerche committed Aug 10, 2010
1 parent b6af5b0 commit bfdea45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bundler.rb
Expand Up @@ -194,7 +194,7 @@ def requires_sudo?
path = path.parent until path.exist?
sudo_present = !`which sudo 2>#{NULL}`.empty?

!settings.path && !File.writable?(path) && sudo_present
settings.allow_sudo? && !File.writable?(path) && sudo_present
end

def mkdir_p(path)
Expand Down
4 changes: 4 additions & 0 deletions lib/bundler/settings.rb
Expand Up @@ -83,6 +83,10 @@ def path
end
end

def allow_sudo?
!@local_config.key?(key_for(:path))
end

private
def key_for(key)
key = key.to_s.sub(".", "__").upcase
Expand Down

0 comments on commit bfdea45

Please sign in to comment.