aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/cli/outdated.rb
diff options
context:
space:
mode:
authorchrismo <chrismo@clabs.org>2016-11-14 16:54:17 -0600
committerchrismo <chrismo@clabs.org>2016-11-15 10:26:55 -0600
commitb3ad1702ba4d45df3d0c85c6585b1a60b9001b3a (patch)
treec0ffa989dc61dd747b770b9c6a5ef7e044518f2e /lib/bundler/cli/outdated.rb
parent291a807c7d6f441253f15a2fda29b2a52035c55a (diff)
downloadbundler-b3ad1702ba4d45df3d0c85c6585b1a60b9001b3a.tar.gz
Refactoring of @lucasmazza fix w/ specs.
The only existing spec coverage was essentially integration level and there was no way either @lucasmazza or myself could find a way to simulate the bug context. I extracted some of the code out of outdated into Definition and SpecSet and added unit specs to those extracted bits.
Diffstat (limited to 'lib/bundler/cli/outdated.rb')
-rw-r--r--lib/bundler/cli/outdated.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index a97cfeae..efbfe7f8 100644
--- a/lib/bundler/cli/outdated.rb
+++ b/lib/bundler/cli/outdated.rb
@@ -32,7 +32,7 @@ module Bundler
end
Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
- # the patch level options don't work without strict also being true
+ # the patch level options imply strict is also true. It wouldn't make sense otherwise.
strict = options[:strict] || Bundler::CLI::Common.patch_level_options(options).any?
definition_resolution = proc { options[:local] ? definition.resolve_with_cache! : definition.resolve_remotely! }
@@ -54,11 +54,11 @@ module Bundler
dependency = current_dependencies[current_spec.name]
if strict
- active_spec = definition.specs.detect {|spec| spec.name == current_spec.name && spec.match_platform(current_spec.platform) }
+ active_spec = definition.find_resolved_spec(current_spec)
else
- active_specs = definition.index[current_spec.name].select {|spec| spec.match_platform(current_spec.platform) }.sort_by(&:version)
+ active_specs = definition.find_indexed_specs(current_spec)
if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
- active_spec = active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
+ active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
end
active_spec = active_specs.last
end