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

Add 'bundle update --group' option #2731

Merged
merged 1 commit into from
Dec 23, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add 'bundle update --group' option
banyan committed Nov 27, 2013

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit fcb3fa8d58dcf63897c683acef283534c6fe6e90
7 changes: 6 additions & 1 deletion lib/bundler/cli.rb
Original file line number Diff line number Diff line change
@@ -304,11 +304,14 @@ def install
"Use the rubygems modern index instead of the API endpoint"
method_option "jobs", :aliases => "-j", :type => :numeric, :banner =>
"Specify the number of jobs to run in parallel"
method_option "group", :aliases => "-g", :type => :array, :banner =>
"Update a specific group"
def update(*gems)
sources = Array(options[:source])
groups = Array(options[:group]).map(&:to_sym)
Bundler.ui.level = "warn" if options[:quiet]

if gems.empty? && sources.empty?
if gems.empty? && sources.empty? && groups.empty?
# We're doing a full update
Bundler.definition(true)
else
@@ -318,6 +321,8 @@ def update(*gems)
next if names.include?(g)
raise GemNotFound, not_found_message(g, names)
end
specs = Bundler.definition.specs_for groups
sources.concat(specs.map(&:name))
Bundler.definition(:gems => gems, :sources => sources)
end

16 changes: 16 additions & 0 deletions spec/update/gems_spec.rb
Original file line number Diff line number Diff line change
@@ -83,6 +83,22 @@
expect(out).not_to match(/Fetching source index/)
end
end

describe "with --group option" do
it "should update only specifed group gems" do
install_gemfile <<-G
source "file://#{gem_repo2}"
gem "activesupport", :group => :development
gem "rack"
G
update_repo2 do
build_gem "activesupport", "3.0"
end
bundle "update --group development"
should_be_installed "activesupport 3.0"
should_not_be_installed "rack 1.2"
end
end
end

describe "bundle update in more complicated situations" do