Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Add --gemfile option to bundle install
Browse files Browse the repository at this point in the history
  • Loading branch information
indirect committed Mar 5, 2010
1 parent 336fdb6 commit ff0a837
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ def check
method_option "without", :type => :array, :banner => "Exclude gems that are part of the specified named group."
method_option "relock", :type => :boolean, :banner => "Unlock, install the gems, and relock."
method_option "disable-shared-gems", :type => :boolean, :banner => "Do not use any shared gems, such as the system gem repository."
method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile"
def install(path = nil)
opts = options.dup
opts[:without] ||= []
opts[:without].map! { |g| g.to_sym }

# Can't use Bundler.settings for this because settings needs gemfile.dirname
ENV['BUNDLE_GEMFILE'] = opts[:gemfile] if opts[:gemfile]
Bundler.settings[:path] = path if path
Bundler.settings[:disable_shared_gems] = '1' if options["disable-shared-gems"]
Bundler.settings.without = opts[:without]
Expand Down
15 changes: 15 additions & 0 deletions spec/install/gems_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,21 @@
end
end


describe "when passing in a Gemfile via --gemfile" do
it "finds the gemfile" do
gemfile bundled_app("NotGemfile"), <<-G
source "file://#{gem_repo1}"
gem 'rack'
G

bundle :install, :gemfile => bundled_app("NotGemfile")

ENV['BUNDLE_GEMFILE'] = "NotGemfile"
should_be_installed "rack 1.0.0"
end
end

describe "disabling system gems" do
before :each do
build_gem "rack", "1.0.0", :to_system => true do |s|
Expand Down

0 comments on commit ff0a837

Please sign in to comment.