lib/bundler.rb in bundler-1.0.0.beta.4 vs lib/bundler.rb in bundler-1.0.0.beta.5
- old
+ new
@@ -183,19 +183,13 @@
NULL = WINDOWS ? "NUL" : "/dev/null"
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)
if requires_sudo?
sudo "mkdir -p '#{path}'"
@@ -203,10 +197,10 @@
FileUtils.mkdir_p(path)
end
end
def sudo(str)
- `sudo -p 'Enter your password to install the bundled RubyGems to your system: ' -E #{str}`
+ `sudo -p 'Enter your password to install the bundled RubyGems to your system: ' #{str}`
end
private
def configure_gem_home_and_path