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

Commit

Permalink
Allow bundle outdated to handle all combinations of --major,
Browse files Browse the repository at this point in the history
`--minor`, and `--patch` flags

- Add test coverage for these combination sets
- Fixes #4396
  • Loading branch information
RochesterinNYC authored and indirect committed Mar 28, 2016
1 parent 8897eb9 commit 2fc6026
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/bundler/cli/outdated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ def update_present_via_semver_portions(current_spec, active_spec, options)

update_present = active_major > current_major if options[:major]

if (options[:minor] || options[:patch]) && current_major == active_major
if !update_present && (options[:minor] || options[:patch]) && current_major == active_major
current_minor = current_spec.version.segments[1, 1].first
active_minor = active_spec.version.segments[1, 1].first

if options[:minor]
update_present = active_minor > current_minor
elsif options[:patch] && current_minor == active_minor
update_present = active_minor > current_minor if options[:minor]

if !update_present && options[:patch] && current_minor == active_minor
current_patch = current_spec.version.segments[2, 1].first
active_patch = active_spec.version.segments[2, 1].first

Expand Down
32 changes: 32 additions & 0 deletions spec/commands/outdated_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -345,4 +345,36 @@
it_behaves_like "major version is ignored"
it_behaves_like "minor version is ignored"
end

describe "with --minor --patch options" do
subject { bundle "outdated --minor --patch" }

it_behaves_like "minor version updates are detected"
it_behaves_like "patch version updates are detected"
it_behaves_like "major version is ignored"
end

describe "with --major --minor options" do
subject { bundle "outdated --major --minor" }

it_behaves_like "major version updates are detected"
it_behaves_like "minor version updates are detected"
it_behaves_like "patch version is ignored"
end

describe "with --major --patch options" do
subject { bundle "outdated --major --patch" }

it_behaves_like "major version updates are detected"
it_behaves_like "patch version updates are detected"
it_behaves_like "minor version is ignored"
end

describe "with --major --minor --patch options" do
subject { bundle "outdated --major --minor --patch" }

it_behaves_like "major version updates are detected"
it_behaves_like "minor version updates are detected"
it_behaves_like "patch version updates are detected"
end
end

0 comments on commit 2fc6026

Please sign in to comment.