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

Commit

Permalink
Respect --conservative flag when updating a dependency group
Browse files Browse the repository at this point in the history
  • Loading branch information
greysteil committed Jun 6, 2018
1 parent 43b4fa9 commit c39a2d3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bundler/cli/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def run
Bundler::CLI::Common.ensure_all_gems_in_lockfile!(gems)

if groups.any?
specs = Bundler.definition.specs_for groups
gems.concat(specs.map(&:name))
deps = Bundler.definition.dependencies.select {|d| (d.groups & groups).any? }
gems.concat(deps.map(&:name))
end

Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby],
Expand Down
17 changes: 17 additions & 0 deletions spec/commands/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,23 @@
expect(the_bundle).not_to include_gems "rack 1.2"
end

context "when conservatively updating a group with non-group sub-deps" do
it "should update only specified group gems" do
install_gemfile <<-G
source "file://#{gem_repo2}"
gem "activemerchant", :group => :development
gem "activesupport"
G
update_repo2 do
build_gem "activemerchant", "2.0"
build_gem "activesupport", "3.0"
end
bundle "update --conservative --group development"
expect(the_bundle).to include_gems "activemerchant 2.0"
expect(the_bundle).not_to include_gems "activesupport 3.0"
end
end

context "when there is a source with the same name as a gem in a group" do
before :each do
build_git "foo", :path => lib_path("activesupport")
Expand Down

0 comments on commit c39a2d3

Please sign in to comment.