summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/cli/outdated.rb8
-rw-r--r--lib/bundler/definition.rb8
-rw-r--r--lib/bundler/spec_set.rb4
3 files changed, 16 insertions, 4 deletions
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index a97cfeae4b..efbfe7f89b 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
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index b9ac233f29..6e3b655706 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -531,6 +531,14 @@ module Bundler
add_platform(generic(current_platform))
end
+ def find_resolved_spec(current_spec)
+ specs.find_by_name_and_platform(current_spec.name, current_spec.platform)
+ end
+
+ def find_indexed_specs(current_spec)
+ index[current_spec.name].select {|spec| spec.match_platform(current_spec.platform) }.sort_by(&:version)
+ end
+
attr_reader :sources
private :sources
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index fe31b17f0e..d3ffa0d5ca 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -114,6 +114,10 @@ module Bundler
SpecSet.new(arr)
end
+ def find_by_name_and_platform(name, platform)
+ @specs.detect {|spec| spec.name == name && spec.match_platform(platform) }
+ end
+
private
def sorted