summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-08-03 15:03:14 -0700
committerCarl Lerche <carllerche@mac.com>2010-08-03 15:03:14 -0700
commitc18bfd3298306449e0d090ecbfdffe401c0f9ff3 (patch)
tree2f1a66aaa16b897495c9d6bd98e63e45c3dd72d1
parentc1f4c1ece42bb85ea1d4cb733a759537c733b56d (diff)
downloadbundler-c18bfd3298306449e0d090ecbfdffe401c0f9ff3.tar.gz
Add --gemfile as a flag for bundle check.
-rw-r--r--lib/bundler/cli.rb3
-rw-r--r--spec/other/check_spec.rb11
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index b2a2abbd19..af420e56fb 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -58,7 +58,10 @@ module Bundler
all gems are found, Bundler prints a success message and exits with a status of 0.
If not, the first missing gem is listed and Bundler exits status 1.
D
+ method_option "gemfile", :type => :string, :banner =>
+ "Use the specified gemfile instead of Gemfile"
def check
+ ENV['BUNDLE_GEMFILE'] = File.expand_path(options[:gemfile]) if options[:gemfile]
begin
not_installed = Bundler.definition.missing_specs
rescue GemNotFound, VersionConflict
diff --git a/spec/other/check_spec.rb b/spec/other/check_spec.rb
index d72cfb9d75..a371a207cf 100644
--- a/spec/other/check_spec.rb
+++ b/spec/other/check_spec.rb
@@ -12,6 +12,17 @@ describe "bundle check" do
out.should == "The Gemfile's dependencies are satisfied"
end
+ it "works with the --gemfile flag when not in the directory" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rails"
+ G
+
+ Dir.chdir tmp
+ bundle "check --gemfile bundled_app/Gemfile"
+ out.should == "The Gemfile's dependencies are satisfied"
+ end
+
it "creates a Gemfile.lock if one did not exist" do
install_gemfile <<-G
source "file://#{gem_repo1}"