summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenji Okimoto <okimoto@clear-code.com>2018-03-01 17:11:39 +0900
committerKenji Okimoto <okimoto@clear-code.com>2018-04-23 09:20:24 +0900
commit6b112d2511c136284b306e57fc51ccf4c0ea336e (patch)
tree16f65f513b95596675932ba2dbe1e21bfc99b6af
parent948771063c05a56af8888acf5c01171293371214 (diff)
downloadbundler-6b112d2511c136284b306e57fc51ccf4c0ea336e.tar.gz
Display reason to require sudo
This is useful for non-interactive installation with bundler.
-rw-r--r--lib/bundler.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 9944ebd051..ae26dea26c 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -367,6 +367,10 @@ EOF
# if any directory is not writable, we need sudo
files = [path, bin_dir] | Dir[bundle_path.join("build_info/*").to_s] | Dir[bundle_path.join("*").to_s]
sudo_needed = files.any? {|f| !File.writable?(f) }
+ if sudo_needed
+ unwritable_files = files.reject {|f| File.writable?(f) }
+ Bundler.ui.warn "Following files may not be writable, so sudo is needed: #{unwritable_files.map(&:to_s).join(',')}"
+ end
end
@requires_sudo_ran = true