Parent

Included Modules

Class Index [+]

Quicksearch

Bundler::SpecSet

Public Class Methods

new(specs) click to toggle source
   # File lib/bundler/spec_set.rb, line 7
7:     def initialize(specs)
8:       @specs = specs.sort_by { |s| s.name }
9:     end

Public Instance Methods

[](key) click to toggle source
    # 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
[]=(key, value) click to toggle source
    # 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
each() click to toggle source
    # File lib/bundler/spec_set.rb, line 11
11:     def each
12:       sorted.each { |s| yield s }
13:     end
for(dependencies, skip = [], check = false, match_current_platform = false) click to toggle source
    # 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
length() click to toggle source
    # File lib/bundler/spec_set.rb, line 15
15:     def length
16:       @specs.length
17:     end
materialize(deps, missing_specs = nil) click to toggle source
    # 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
merge(set) click to toggle source
     # 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
to_a() click to toggle source
    # File lib/bundler/spec_set.rb, line 71
71:     def to_a
72:       sorted.dup
73:     end
to_hash() click to toggle source
    # File lib/bundler/spec_set.rb, line 75
75:     def to_hash
76:       lookup.dup
77:     end
valid_for?(deps) click to toggle source
    # File lib/bundler/spec_set.rb, line 55
55:     def valid_for?(deps)
56:       self.for(deps, [], true)
57:     end

Private Instance Methods

lookup() click to toggle source
     # 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
sorted() click to toggle source
     # 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
tsort_each_child(s) click to toggle source
     # File lib/bundler/spec_set.rb, line 127
127:     def tsort_each_child(s)
128:       s.dependencies.sort_by { |d| d.name }.each do |d|
129:         next if d.type == :development
130:         lookup[d.name].each { |s2| yield s2 }
131:       end
132:     end
tsort_each_node() click to toggle source
     # File lib/bundler/spec_set.rb, line 123
123:     def tsort_each_node
124:       @specs.each { |s| yield s }
125:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.