Object
# File lib/bundler/spec_set.rb, line 59
59: def [](key)
60: key = key.name if key.respond_to?(:name)
61: lookup[key].reverse
62: end
# File lib/bundler/spec_set.rb, line 64
64: def []=(key, value)
65: @specs << value
66: @lookup = nil
67: @sorted = nil
68: value
69: end
# File lib/bundler/spec_set.rb, line 11
11: def each
12: sorted.each { |s| yield s }
13: end
# File lib/bundler/spec_set.rb, line 19
19: def for(dependencies, skip = [], check = false, match_current_platform = false)
20: handled, deps, specs = {}, dependencies.dup, []
21: skip << 'bundler'
22:
23: until deps.empty?
24: dep = deps.shift
25: next if handled[dep] || skip.include?(dep.name)
26:
27: spec = lookup[dep.name].find do |s|
28: match_current_platform ?
29: Gem::Platform.match(s.platform) :
30: s.match_platform(dep.__platform)
31: end
32:
33: handled[dep] = true
34:
35: if spec
36: specs << spec
37:
38: spec.dependencies.each do |d|
39: next if d.type == :development
40: d = DepProxy.new(d, dep.__platform) unless match_current_platform
41: deps << d
42: end
43: elsif check
44: return false
45: end
46: end
47:
48: if spec = lookup['bundler'].first
49: specs << spec
50: end
51:
52: check ? true : SpecSet.new(specs)
53: end
# File lib/bundler/spec_set.rb, line 15
15: def length
16: @specs.length
17: end
# File lib/bundler/spec_set.rb, line 79
79: def materialize(deps, missing_specs = nil)
80: materialized = self.for(deps, [], false, true).to_a
81: materialized.map! do |s|
82: next s unless s.is_a?(LazySpecification)
83: spec = s.__materialize__
84: if missing_specs
85: missing_specs << s unless spec
86: else
87: raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
88: end
89: spec if spec
90: end
91: SpecSet.new(materialized.compact)
92: end
# File lib/bundler/spec_set.rb, line 94
94: def merge(set)
95: arr = sorted.dup
96: set.each do |s|
97: next if arr.any? { |s2| s2.name == s.name && s2.version == s.version && s2.platform == s.platform }
98: arr << s
99: end
100: SpecSet.new(arr)
101: end
# File lib/bundler/spec_set.rb, line 71
71: def to_a
72: sorted.dup
73: end
# File lib/bundler/spec_set.rb, line 110
110: def lookup
111: @lookup ||= begin
112: lookup = Hash.new { |h,k| h[k] = [] }
113: specs = @specs.sort_by do |s|
114: s.platform.to_s == 'ruby' ? "\00"" : s.platform.to_s
115: end
116: specs.reverse_each do |s|
117: lookup[s.name] << s
118: end
119: lookup
120: end
121: end
# File lib/bundler/spec_set.rb, line 105
105: def sorted
106: rake = @specs.find { |s| s.name == 'rake' }
107: @sorted ||= ([rake] + tsort).compact.uniq
108: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.