summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-02-05 15:46:19 -0800
committerCarl Lerche <carllerche@mac.com>2010-02-05 15:46:19 -0800
commit54026a158ea851f688ac4d87a8c739fb30753bfb (patch)
treecd34f51a040713cdb52bdd66a8281b5949bf965b
parent27e509d2509e3b9df7aec77e5eaeb32093ebbec1 (diff)
downloadbundler-54026a158ea851f688ac4d87a8c739fb30753bfb.tar.gz
Look for ENV['BUNDLE_GEMFILE'] first before searching Dir.pwd for a Gemfile.
-rw-r--r--bundler.gemspec2
-rw-r--r--lib/bundler.rb4
-rw-r--r--spec/runtime/setup_spec.rb17
-rw-r--r--spec/spec_helper.rb13
4 files changed, 29 insertions, 7 deletions
diff --git a/bundler.gemspec b/bundler.gemspec
index c3bca3fb20..5f412d77b7 100644
--- a/bundler.gemspec
+++ b/bundler.gemspec
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
s.default_executable = %q{bundle}
s.email = ["carlhuda@engineyard.com"]
s.executables = ["bundle"]
- s.files = ["bin/bundle", "lib/bundler/cli.rb", "lib/bundler/definition.rb", "lib/bundler/dependency.rb", "lib/bundler/dsl.rb", "lib/bundler/environment.rb", "lib/bundler/index.rb", "lib/bundler/installer.rb", "lib/bundler/remote_specification.rb", "lib/bundler/resolver.rb", "lib/bundler/rubygems.rb", "lib/bundler/runtime.rb", "lib/bundler/settings.rb", "lib/bundler/setup.rb", "lib/bundler/source.rb", "lib/bundler/specification.rb", "lib/bundler/templates/environment.erb", "lib/bundler/templates/Gemfile", "lib/bundler/ui.rb", "lib/bundler/vendor/thor/base.rb", "lib/bundler/vendor/thor/core_ext/file_binary_read.rb", "lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb", "lib/bundler/vendor/thor/core_ext/ordered_hash.rb", "lib/bundler/vendor/thor/error.rb", "lib/bundler/vendor/thor/invocation.rb", "lib/bundler/vendor/thor/parser/argument.rb", "lib/bundler/vendor/thor/parser/arguments.rb", "lib/bundler/vendor/thor/parser/option.rb", "lib/bundler/vendor/thor/parser/options.rb", "lib/bundler/vendor/thor/parser.rb", "lib/bundler/vendor/thor/shell/basic.rb", "lib/bundler/vendor/thor/shell/color.rb", "lib/bundler/vendor/thor/shell.rb", "lib/bundler/vendor/thor/task.rb", "lib/bundler/vendor/thor/util.rb", "lib/bundler/vendor/thor/version.rb", "lib/bundler/vendor/thor.rb", "lib/bundler.rb", "LICENSE", "README.markdown"]
+ s.files = ["bin/bundle", "lib/bundler", "lib/bundler/cli.rb", "lib/bundler/definition.rb", "lib/bundler/dependency.rb", "lib/bundler/dsl.rb", "lib/bundler/environment.rb", "lib/bundler/index.rb", "lib/bundler/installer.rb", "lib/bundler/remote_specification.rb", "lib/bundler/resolver.rb", "lib/bundler/rubygems.rb", "lib/bundler/runtime.rb", "lib/bundler/settings.rb", "lib/bundler/setup.rb", "lib/bundler/source.rb", "lib/bundler/specification.rb", "lib/bundler/templates", "lib/bundler/templates/environment.erb", "lib/bundler/templates/Gemfile", "lib/bundler/ui.rb", "lib/bundler/vendor", "lib/bundler/vendor/thor", "lib/bundler/vendor/thor/base.rb", "lib/bundler/vendor/thor/core_ext", "lib/bundler/vendor/thor/core_ext/file_binary_read.rb", "lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb", "lib/bundler/vendor/thor/core_ext/ordered_hash.rb", "lib/bundler/vendor/thor/error.rb", "lib/bundler/vendor/thor/invocation.rb", "lib/bundler/vendor/thor/parser", "lib/bundler/vendor/thor/parser/argument.rb", "lib/bundler/vendor/thor/parser/arguments.rb", "lib/bundler/vendor/thor/parser/option.rb", "lib/bundler/vendor/thor/parser/options.rb", "lib/bundler/vendor/thor/parser.rb", "lib/bundler/vendor/thor/shell", "lib/bundler/vendor/thor/shell/basic.rb", "lib/bundler/vendor/thor/shell/color.rb", "lib/bundler/vendor/thor/shell.rb", "lib/bundler/vendor/thor/task.rb", "lib/bundler/vendor/thor/util.rb", "lib/bundler/vendor/thor/version.rb", "lib/bundler/vendor/thor.rb", "lib/bundler.rb", "LICENSE", "README.markdown"]
s.homepage = %q{http://github.com/carlhuda/bundler}
s.post_install_message = %q{Due to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work}
s.require_paths = ["lib"]
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 326dacb595..94cf48ec7e 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -109,6 +109,10 @@ module Bundler
private
def default_gemfile
+ if ENV['BUNDLE_GEMFILE']
+ return Pathname.new(ENV['BUNDLE_GEMFILE'])
+ end
+
current = Pathname.new(Dir.pwd)
until current.root?
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index 6a8c0623ef..582424b26a 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -1,6 +1,23 @@
require File.expand_path('../../spec_helper', __FILE__)
describe "Bundler.setup" do
+ it "uses BUNDLE_GEMFILE to locate the gemfile if present" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+
+ gemfile bundled_app('4realz'), <<-G
+ source "file://#{gem_repo1}"
+ gem "activesupport", "2.3.5"
+ G
+
+ ENV['BUNDLE_GEMFILE'] = bundled_app('4realz').to_s
+ bundle :install
+
+ should_be_installed "activesupport 2.3.5"
+ end
+
describe "cripping rubygems" do
it "replaces #gem with an alternative that raises when appropriate" do
install_gemfile <<-G
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 27066ca525..b13cf63e03 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -21,8 +21,8 @@ Spec::Runner.configure do |config|
config.include Spec::Rubygems
config.include Spec::Platforms
- original_wd = Dir.pwd
- original_path = ENV['PATH']
+ original_wd = Dir.pwd
+ original_path = ENV['PATH']
original_gem_home = ENV['GEM_HOME']
config.before :all do
@@ -39,9 +39,10 @@ Spec::Runner.configure do |config|
Gem.platforms = nil
Dir.chdir(original_wd)
# Reset ENV
- ENV['GEM_HOME'] = original_gem_home
- ENV['GEM_PATH'] = original_gem_home
- ENV['BUNDLE_PATH'] = nil
- ENV['PATH'] = original_path
+ ENV['PATH'] = original_path
+ ENV['GEM_HOME'] = original_gem_home
+ ENV['GEM_PATH'] = original_gem_home
+ ENV['BUNDLE_PATH'] = nil
+ ENV['BUNDLE_GEMFILE'] = nil
end
end \ No newline at end of file