Class: Bundler::Resolver::SpecGroup
- Inherits:
-
Array
- Object
- Array
- Bundler::Resolver::SpecGroup
show all
- Includes:
- GemHelpers
- Defined in:
- lib/bundler/resolver.rb
Constant Summary
Constants included
from GemHelpers
GemHelpers::GENERICS, GemHelpers::GENERIC_CACHE
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from GemHelpers
#generic
Constructor Details
Returns a new instance of SpecGroup.
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/bundler/resolver.rb', line 78
def initialize(a)
super
@required_by = []
@activated = []
@dependencies = nil
@specs = {}
ALL.each do |p|
@specs[p] = reverse.find { |s| s.match_platform(p) }
end
end
|
Instance Attribute Details
#activated ⇒ Object
Returns the value of attribute activated.
76
77
78
|
# File 'lib/bundler/resolver.rb', line 76
def activated
@activated
end
|
#required_by ⇒ Object
Returns the value of attribute required_by.
76
77
78
|
# File 'lib/bundler/resolver.rb', line 76
def required_by
@required_by
end
|
Instance Method Details
112
113
114
115
116
117
118
119
120
|
# File 'lib/bundler/resolver.rb', line 112
def activate_platform(platform)
unless @activated.include?(platform)
if for?(platform)
@activated << platform
return __dependencies[platform] || []
end
end
[]
end
|
142
143
144
|
# File 'lib/bundler/resolver.rb', line 142
def dependencies_for_activated_platforms
@activated.map { |p| __dependencies[p] }.flatten
end
|
#for?(platform) ⇒ Boolean
134
135
136
|
# File 'lib/bundler/resolver.rb', line 134
def for?(platform)
@specs[platform]
end
|
#initialize_copy(o) ⇒ Object
90
91
92
93
94
|
# File 'lib/bundler/resolver.rb', line 90
def initialize_copy(o)
super
@required_by = o.required_by.dup
@activated = o.activated.dup
end
|
#name ⇒ Object
122
123
124
|
# File 'lib/bundler/resolver.rb', line 122
def name
@name ||= first.name
end
|
146
147
148
|
# File 'lib/bundler/resolver.rb', line 146
def platforms_for_dependency_named(dependency)
__dependencies.select { |p, deps| deps.map(&:name).include? dependency }.keys
end
|
#source ⇒ Object
130
131
132
|
# File 'lib/bundler/resolver.rb', line 130
def source
@source ||= first.source
end
|
#to_s ⇒ Object
138
139
140
|
# File 'lib/bundler/resolver.rb', line 138
def to_s
"#{name} (#{version})"
end
|
#to_specs ⇒ Object
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/bundler/resolver.rb', line 96
def to_specs
specs = {}
@activated.each do |p|
if s = @specs[p]
platform = generic(Gem::Platform.new(s.platform))
next if specs[platform]
lazy_spec = LazySpecification.new(name, version, platform, source)
lazy_spec.dependencies.replace s.dependencies
specs[platform] = lazy_spec
end
end
specs.values
end
|
#version ⇒ Object
126
127
128
|
# File 'lib/bundler/resolver.rb', line 126
def version
@version ||= first.version
end
|