diff options
author | Carl Lerche <carllerche@mac.com> | 2010-02-10 22:45:20 -0800 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-02-10 22:45:20 -0800 |
commit | 4d849061246156d0c36015fe1ced3d930199a41e (patch) | |
tree | 1d4a959a195f14ab2ccb11d8a29f9bf540202e79 | |
parent | 5f5ac21b4161b1638ac196e554439d2aab9799e4 (diff) | |
download | bundler-4d849061246156d0c36015fe1ced3d930199a41e.tar.gz |
Regenerate .bundle/environment.rb during bundle check
-rw-r--r-- | lib/bundler/cli.rb | 3 | ||||
-rw-r--r-- | lib/bundler/runtime.rb | 5 | ||||
-rw-r--r-- | spec/other/check_spec.rb | 21 |
3 files changed, 24 insertions, 5 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 5850e62a6f..034dec14a8 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -58,6 +58,9 @@ module Bundler remove_lockfiles if options[:relock] Installer.install(Bundler.root, Bundler.definition, opts) + # Ensures that .bundle/environment.rb exists + # TODO: Figure out a less hackish way to do this + Bundler.load lock if options[:relock] end diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index 494e758f79..914e0ee13e 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -4,11 +4,14 @@ module Bundler class Runtime < Environment include SharedHelpers - def setup(*groups) + def initialize(*) + super if locked? # && !rb_lock_file.exist? write_rb_lock end + end + def setup(*groups) # Has to happen first clean_load_path diff --git a/spec/other/check_spec.rb b/spec/other/check_spec.rb index 3f9846aad8..1ddf555d16 100644 --- a/spec/other/check_spec.rb +++ b/spec/other/check_spec.rb @@ -1,10 +1,6 @@ require File.expand_path('../../spec_helper', __FILE__) describe "bundle check" do - before :each do - in_app_root - end - it "returns success when the Gemfile is satisfied" do install_gemfile <<-G source "file://#{gem_repo1}" @@ -63,4 +59,21 @@ describe "bundle check" do @exitstatus.should_not == 0 if @exitstatus out.should =~ /The default Gemfile was not found/ end + + describe "when locked" do + before :each do + system_gems "rack-1.0.0" + gemfile <<-G + source "file://#{gem_repo1}" + gem "rack" + G + bundle "lock" + end + + it "rebuilds .bundle/environment.rb " do + bundled_app('.bundle/environment.rb').delete + bundle :check + bundled_app('.bundle/environment.rb').should exist + end + end end |