summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenji Okimoto <okimoto@clear-code.com>2018-04-23 09:28:56 +0900
committerKenji Okimoto <okimoto@clear-code.com>2018-04-23 09:28:56 +0900
commit04e888e25e45d3eda46e8bd6f6385a96f3661722 (patch)
tree0172073e0038c1b37225d9f396709be5b829c107
parent20fc9c746b627e6d189dea552b4a0893059c8ccb (diff)
downloadbundler-04e888e25e45d3eda46e8bd6f6385a96f3661722.tar.gz
Display unwritable files in each line
-rw-r--r--lib/bundler.rb2
-rw-r--r--spec/bundler/bundler_spec.rb12
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 0b6f70d9df..468d3b0a06 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -369,7 +369,7 @@ EOF
unwritable_files = files.reject {|f| File.writable?(f) }
sudo_needed = !unwritable_files.empty?
if sudo_needed
- Bundler.ui.warn "Following files may not be writable, so sudo is needed: #{unwritable_files.map(&:to_s).join(",")}"
+ Bundler.ui.warn "Following files may not be writable, so sudo is needed:\n #{unwritable_files.map(&:to_s).join("\n ")}"
end
end
diff --git a/spec/bundler/bundler_spec.rb b/spec/bundler/bundler_spec.rb
index 3e23f60f82..0cc3bcd032 100644
--- a/spec/bundler/bundler_spec.rb
+++ b/spec/bundler/bundler_spec.rb
@@ -320,12 +320,18 @@ EOF
end
context "unwritable paths" do
before do
- FileUtils.touch("tmp/vendor/bundle/unwritable.txt")
- FileUtils.chmod(0o400, "tmp/vendor/bundle/unwritable.txt")
+ FileUtils.touch("tmp/vendor/bundle/unwritable1.txt")
+ FileUtils.touch("tmp/vendor/bundle/unwritable2.txt")
+ FileUtils.chmod(0o400, "tmp/vendor/bundle/unwritable1.txt")
+ FileUtils.chmod(0o400, "tmp/vendor/bundle/unwritable2.txt")
end
it "should return true and display warn message" do
allow(Bundler).to receive(:bundle_path).and_return(Pathname("tmp/vendor/bundle"))
- message = "Following files may not be writable, so sudo is needed: tmp/vendor/bundle/unwritable.txt"
+ message = <<-MESSAGE.chomp
+Following files may not be writable, so sudo is needed:
+ tmp/vendor/bundle/unwritable1.txt
+ tmp/vendor/bundle/unwritable2.txt
+MESSAGE
expect(Bundler.ui).to receive(:warn).with(message)
expect(Bundler.requires_sudo?).to eq(true)
end