summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-07-11 03:22:04 -0300
committerAndre Arko <andre@arko.net>2010-07-11 18:11:41 -0700
commit52576d54bde42221d59bdd48171e891413be630b (patch)
tree2cfa121df7b7032cb2668c738edf87db85f9b876
parente82aaf32fa2b2e7f5c21c898c520a71ebb1a64d6 (diff)
downloadbundler-52576d54bde42221d59bdd48171e891413be630b.tar.gz
requires_sudo if the path is not writable and sudo command exist
-rw-r--r--lib/bundler.rb10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index eff89f2537..f751d655e1 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -185,15 +185,9 @@ module Bundler
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)