blob: fde443dd7aa6212dcf49b55eb388c868fb062a69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
require "uri"
require "rubygems/spec_fetcher"
module Bundler
class LazySpecification
attr_reader :name, :version, :dependencies, :platform
attr_accessor :source
def initialize(name, version, platform)
@name = name
@version = version
@dependencies = []
@platform = platform
@source = nil
end
def full_name
if platform == Gem::Platform::RUBY or platform.nil? then
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{platform}"
end
end
def satisfies?(dependency)
@name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version))
end
def __materialize__(index)
@specification = index.search(self).first
raise "Could not materialize #{full_name}" unless @specification
end
def respond_to?(*args)
super || @specification.respond_to?(*args)
end
private
def method_missing(method, *args, &blk)
if Gem::Specification.new.respond_to?(method)
raise "LazySpecification has not been materialized yet" unless @specification
@specification.send(method, *args, &blk)
else
super
end
end
end
end
|