Polisher::Gemfile#dependency_versions ignores the Gemfile version constraint and just returns all versions of all gem dependencies from the Gemfile available in koji. It doesn't check the version constraint.
require 'pathname'
require 'polisher/gemfile'
# Only check koji
targets = [:koji]
Polisher::VersionChecker.check(targets)
require 'polisher/koji'
# Write out a basic Gemfile
gemfile = Pathname.new("./Gemfile").expand_path
contents = <<-EOS
source 'https://rubygems.org'
gem 'bundler', '~> 1.6.0'
EOS
File.write(gemfile, contents)
gemfile = Polisher::Gemfile.parse(gemfile)
packages = gemfile.dependency_versions(:recursive => false, :dev_deps => false)
puts packages.inspect
Output:
D, [2014-07-02T11:55:50.838449 #60328] DEBUG -- : versions_for<koji>(bundler)...
D, [2014-07-02T11:55:51.627573 #60328] DEBUG -- : ["1.5.2", "1.3.5", "1.3.1", "1.1.4"]
{"bundler"=>{:koji=>["1.5.2", "1.3.5", "1.3.1", "1.1.4"]}}
Even though the Gemfile says ~> 1.6.0, Polisher::Gemfile#dependency_versions ignores this and only returns the versions of all dependencies.