Sha256: 395035f3abb93a2310b8f3823d1ddbc1625e6e83e1b32be35a235c5e58525867
Contents?: true
Size: 1.35 KB
Versions: 3
Compression:
Stored size: 1.35 KB
Contents
require 'rubygems' module MetricFu class GemVersion def initialize @gem_spec = Gem::Specification.load(gemspec) end def gemspec gemspec = File.join(MetricFu.root_dir, 'metric_fu.gemspec') end def new_dependency(name, version) Gem::Dependency.new(name, version, :runtime) end def gem_runtime_dependencies @gem_runtime_dependencies ||= begin @gem_spec.dependencies.select{|gem| gem.type == :runtime}.each do |gem_dep| gem_dep.name = gem_dep.name.downcase.sub('metric_fu-','') end << new_dependency('rcov', ['~> 0.8']) end end def for(name) name.downcase! dep = gem_runtime_dependencies.find(unknown_dependency(name)) do |gem_dep| gem_dep.name == name end dep.requirements_list end def unknown_dependency(name) ->{ new_dependency(name, ['>= 0']) } end RESOLVER = new def self.for(name) RESOLVER.for(name).dup end def self.dependencies RESOLVER.gem_runtime_dependencies.dup end def self.dependencies_summary dependencies.map do |gem_dep| { 'name' => gem_dep.name, 'version' => gem_dep.requirements_list, } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
metric_fu-4.6.0 | lib/metric_fu/gem_version.rb |
metric_fu-4.5.2 | lib/metric_fu/gem_version.rb |
metric_fu-4.5.1 | lib/metric_fu/gem_version.rb |