class Bundler::Resolver::SpecGroup
Public Class Methods
new(specs)
click to toggle source
# File bundler/resolver/spec_group.rb, line 6 def initialize(specs) @specs = specs end
Public Instance Methods
dependencies()
click to toggle source
# File bundler/resolver/spec_group.rb, line 38 def dependencies @dependencies ||= @specs.map do |spec| __dependencies(spec) + metadata_dependencies(spec) end.flatten.uniq end
empty?()
click to toggle source
# File bundler/resolver/spec_group.rb, line 10 def empty? @specs.empty? end
name()
click to toggle source
# File bundler/resolver/spec_group.rb, line 14 def name @name ||= exemplary_spec.name end
source()
click to toggle source
# File bundler/resolver/spec_group.rb, line 22 def source @source ||= exemplary_spec.source end
to_s()
click to toggle source
# File bundler/resolver/spec_group.rb, line 34 def to_s sorted_spec_names.join(", ") end
to_specs(force_ruby_platform)
click to toggle source
# File bundler/resolver/spec_group.rb, line 26 def to_specs(force_ruby_platform) @specs.map do |s| lazy_spec = LazySpecification.from_spec(s) lazy_spec.force_ruby_platform = force_ruby_platform lazy_spec end end
version()
click to toggle source
# File bundler/resolver/spec_group.rb, line 18 def version @version ||= exemplary_spec.version end
Protected Instance Methods
sorted_spec_names()
click to toggle source
# File bundler/resolver/spec_group.rb, line 46 def sorted_spec_names @sorted_spec_names ||= @specs.map(&:full_name).sort end
Private Instance Methods
__dependencies(spec)
click to toggle source
# File bundler/resolver/spec_group.rb, line 56 def __dependencies(spec) dependencies = [] spec.dependencies.each do |dep| next if dep.type == :development dependencies << Dependency.new(dep.name, dep.requirement) end dependencies end
exemplary_spec()
click to toggle source
# File bundler/resolver/spec_group.rb, line 52 def exemplary_spec @specs.first end
metadata_dependencies(spec)
click to toggle source
# File bundler/resolver/spec_group.rb, line 65 def metadata_dependencies(spec) [ metadata_dependency("Ruby", spec.required_ruby_version), metadata_dependency("RubyGems", spec.required_rubygems_version), ].compact end
metadata_dependency(name, requirement)
click to toggle source
# File bundler/resolver/spec_group.rb, line 72 def metadata_dependency(name, requirement) return if requirement.nil? || requirement.none? Dependency.new("#{name}\0", requirement) end