Permalink
Browse files

don't lock development changes while injecting

  • Loading branch information...
1 parent 0d2f5f5 commit 5ceee39cb47f7418b0ae872a01d8b22cbc0a0bea @indirect indirect committed Oct 3, 2012
Showing with 17 additions and 2 deletions.
  1. +6 −2 lib/bundler/injector.rb
  2. +11 −0 spec/integration/inject.rb
View
@@ -10,8 +10,12 @@ def initialize(new_deps)
end
def inject(gemfile_path, lockfile_path)
- # temporarily ignore the frozen setting
- frozen = Bundler.settings.delete(:frozen)
+ if Bundler.settings[:frozen]
+ # ensure the lock and Gemfile are synced
+ Bundler.definition.ensure_equivalent_gemfile_and_lockfile(true)
+ # temporarily remove frozen while we inject
+ frozen = Bundler.settings.delete(:frozen)
+ end
# evaluate the Gemfile we have now
builder = Dsl.new
View
@@ -63,5 +63,16 @@
config = YAML.load(bundled_app(".bundle/config").read)
config["BUNDLE_FROZEN"].should == "1"
end
+
+ it "doesn't allow Gemfile changes" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack-obama"
+ G
+ bundle "inject 'rack' '> 0'"
+ out.should match(/trying to install in deployment mode after changing/)
+
+ bundled_app("Gemfile.lock").read.should_not match(/rack-obama/)
+ end
end
end

0 comments on commit 5ceee39

Please sign in to comment.