Permalink
Browse files

requires_sudo if the path is not writable and sudo command exist

  • Loading branch information...
spastorino authored and indirect committed Jul 11, 2010
1 parent e82aaf3 commit 52576d54bde42221d59bdd48171e891413be630b
Showing with 2 additions and 8 deletions.
  1. +2 −8 lib/bundler.rb
View
@@ -185,15 +185,9 @@ def default_gemfile
def requires_sudo?
path = bundle_path
path = path.parent until path.exist?
+ sudo_present = !`which sudo 2>#{NULL}`.empty?
- case
- when File.writable?(path) ||
- `which sudo 2>#{NULL}`.empty? ||
- File.owned?(path)
- false
- else
- true
- end
+ !File.writable?(path) && sudo_present
end
def mkdir_p(path)

0 comments on commit 52576d5

Please sign in to comment.