Class: Bundler::Resolver::SpecGroup
- Inherits:
- 
      Object
      
        - Object
- Bundler::Resolver::SpecGroup
 
- Includes:
- GemHelpers
- Defined in:
- lib/bundler/resolver/spec_group.rb
Constant Summary
Constants included from GemHelpers
GemHelpers::GENERICS, GemHelpers::GENERIC_CACHE
Instance Attribute Summary collapse
- 
  
    
      #activated_platforms  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute activated_platforms. 
- 
  
    
      #ignores_bundler_dependencies  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute ignores_bundler_dependencies. 
- 
  
    
      #name  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute name. 
- 
  
    
      #source  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute source. 
- 
  
    
      #version  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute version. 
Instance Method Summary collapse
- #==(other) ⇒ Object
- #copy_for(platforms) ⇒ Object
- #dependencies_for_activated_platforms ⇒ Object
- #eql?(other) ⇒ Boolean
- #for?(platform) ⇒ Boolean
- #hash ⇒ Object
- 
  
    
      #initialize(all_specs)  ⇒ SpecGroup 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of SpecGroup. 
- #to_s ⇒ Object
- #to_specs ⇒ Object
Methods included from GemHelpers
generic, generic_local_platform, local_platform, platform_specificity_match, same_deps, same_specificity, select_best_platform_match
Constructor Details
#initialize(all_specs) ⇒ SpecGroup
Returns a new instance of SpecGroup.
| 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # File 'lib/bundler/resolver/spec_group.rb', line 11 def initialize(all_specs) @all_specs = all_specs raise ArgumentError, "cannot initialize with an empty value" unless exemplary_spec = all_specs.first @name = exemplary_spec.name @version = exemplary_spec.version @source = exemplary_spec.source @activated_platforms = [] @dependencies = nil @specs = Hash.new do |specs, platform| specs[platform] = select_best_platform_match(all_specs, platform) end @ignores_bundler_dependencies = true end | 
Instance Attribute Details
#activated_platforms ⇒ Object
Returns the value of attribute activated_platforms.
| 9 10 11 | # File 'lib/bundler/resolver/spec_group.rb', line 9 def activated_platforms @activated_platforms end | 
#ignores_bundler_dependencies ⇒ Object
Returns the value of attribute ignores_bundler_dependencies.
| 9 10 11 | # File 'lib/bundler/resolver/spec_group.rb', line 9 def ignores_bundler_dependencies @ignores_bundler_dependencies end | 
#name ⇒ Object
Returns the value of attribute name.
| 8 9 10 | # File 'lib/bundler/resolver/spec_group.rb', line 8 def name @name end | 
#source ⇒ Object
Returns the value of attribute source.
| 8 9 10 | # File 'lib/bundler/resolver/spec_group.rb', line 8 def source @source end | 
#version ⇒ Object
Returns the value of attribute version.
| 8 9 10 | # File 'lib/bundler/resolver/spec_group.rb', line 8 def version @version end | 
Instance Method Details
#==(other) ⇒ Object
| 66 67 68 69 70 71 72 | # File 'lib/bundler/resolver/spec_group.rb', line 66 def ==(other) return unless other.is_a?(SpecGroup) name == other.name && version == other.version && sorted_activated_platforms == other.sorted_activated_platforms && source == other.source end | 
#copy_for(platforms) ⇒ Object
| 39 40 41 42 43 44 45 46 47 | # File 'lib/bundler/resolver/spec_group.rb', line 39 def copy_for(platforms) platforms.select! {|p| for?(p) } return unless platforms.any? copied_sg = self.class.new(@all_specs) copied_sg.ignores_bundler_dependencies = @ignores_bundler_dependencies copied_sg.activated_platforms = platforms copied_sg end | 
#dependencies_for_activated_platforms ⇒ Object
| 58 59 60 61 62 63 64 | # File 'lib/bundler/resolver/spec_group.rb', line 58 def dependencies_for_activated_platforms dependencies = @activated_platforms.map {|p| __dependencies[p] } = @activated_platforms.map do |platform| (@specs[platform].first, platform) end dependencies.concat().flatten end | 
#eql?(other) ⇒ Boolean
| 74 75 76 77 78 79 80 | # File 'lib/bundler/resolver/spec_group.rb', line 74 def eql?(other) return unless other.is_a?(SpecGroup) name.eql?(other.name) && version.eql?(other.version) && sorted_activated_platforms.eql?(other.sorted_activated_platforms) && source.eql?(other.source) end | 
#for?(platform) ⇒ Boolean
| 49 50 51 | # File 'lib/bundler/resolver/spec_group.rb', line 49 def for?(platform) @specs[platform].any? end | 
#hash ⇒ Object
| 82 83 84 | # File 'lib/bundler/resolver/spec_group.rb', line 82 def hash name.hash ^ version.hash ^ sorted_activated_platforms.hash ^ source.hash end | 
#to_s ⇒ Object
| 53 54 55 56 | # File 'lib/bundler/resolver/spec_group.rb', line 53 def to_s activated_platforms_string = sorted_activated_platforms.join(", ") "#{name} (#{version}) (#{activated_platforms_string})" end | 
#to_specs ⇒ Object
| 26 27 28 29 30 31 32 33 34 35 36 37 | # File 'lib/bundler/resolver/spec_group.rb', line 26 def to_specs @activated_platforms.map do |p| specs = @specs[p] next unless specs.any? specs.map do |s| lazy_spec = LazySpecification.new(name, version, s.platform, source) lazy_spec.dependencies.replace s.dependencies lazy_spec end end.flatten.compact.uniq end |