summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-08-05 22:27:50 -0700
committerCarl Lerche <carllerche@mac.com>2010-08-05 22:27:50 -0700
commit96265c4caabef2ceb1fcee3b879b1a1b375c34a4 (patch)
treed3718a5c2747f557955de270fefe6b76c834c8a7
parentee10cd90a533c4d6e13ed020e05f45b69f746886 (diff)
downloadbundler-96265c4caabef2ceb1fcee3b879b1a1b375c34a4.tar.gz
The filesystem might not be writable during runtime when deployed.
-rw-r--r--lib/bundler.rb2
-rw-r--r--spec/runtime/setup_spec.rb19
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 396c3cdb4c..da9b2361a9 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -189,7 +189,7 @@ module Bundler
path = path.parent until path.exist?
sudo_present = !`which sudo 2>#{NULL}`.empty?
- !File.writable?(path) && sudo_present
+ !settings.path && !File.writable?(path) && sudo_present
end
def mkdir_p(path)
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index 271a75f5cd..88729dca3e 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -241,6 +241,25 @@ describe "Bundler.setup" do
FileUtils.rm_rf vendored_gems('cache')
should_be_installed "rack 1.0.0"
end
+
+ it "does not randomly change the path when specifying --path and the bundle directory becomes read only" do
+ begin
+ bundle "install vendor"
+
+ Dir["**/*"].each do |f|
+ File.directory?(f) ?
+ File.chmod(0555, f) :
+ File.chmod(0444, f)
+ end
+ should_be_installed "rack 1.0.0"
+ ensure
+ Dir["**/*"].each do |f|
+ File.directory?(f) ?
+ File.chmod(0755, f) :
+ File.chmod(0644, f)
+ end
+ end
+ end
end
describe "when excluding groups" do