class Polisher::VersionChecker
Public Class Methods
matching_versions(dep)
click to toggle source
Return versions matching dependency
# File lib/polisher/adaptors/version_checker.rb, line 52 def self.matching_versions(dep) versions = versions_for(dep.name).values.flatten.uniq.compact versions.select { |v| dep.match? dep.name, v } end
unknown_version(tgt, name) { |tgt, name, [:unknown]| ... }
click to toggle source
Invoke block for specified target w/ an ‘unknown’ version
# File lib/polisher/adaptors/version_checker.rb, line 47 def self.unknown_version(tgt, name) yield tgt, name, [:unknown] if block_given? end
version_for(name)
click to toggle source
Return version of package most frequent in all configured targets. Invokes query as normal then counts versions over all targets and returns the max.
# File lib/polisher/adaptors/version_checker.rb, line 38 def self.version_for(name) versions = versions_for(name).values versions.inject(Hash.new(0)) do |total, i| total[i] += 1 total end.first end
versions_for(name, &bl)
click to toggle source
Retrieve all the versions of the specified package using the configured targets.
If not specified, all targets are checked @param [String] name name of package to query @param [Callable] bl optional block to invoke with versions retrieved @returns [Hash<target,Array<String>>] returns a hash of target to versions available for specified package
# File lib/polisher/adaptors/version_checker.rb, line 22 def self.versions_for(name, &bl) versions = {} all_targets.each do |target| if should_check?(target) target_versions = send target_method(target), name, &bl versions.merge! target => target_versions end end versions end