Class: Bundler::GemSource
- Inherits:
-
Source
- Object
- Source
- Bundler::GemSource
show all
- Defined in:
- lib/bowline/bundler/source.rb
Defined Under Namespace
Classes: RubygemsRetardation
Instance Attribute Summary collapse
Attributes inherited from Source
#bundle, #local
Instance Method Summary
collapse
Constructor Details
#initialize(bundle, options) ⇒ GemSource
Returns a new instance of GemSource.
29
30
31
32
33
34
|
# File 'lib/bowline/bundler/source.rb', line 29
def initialize(bundle, options)
super
@uri = options[:uri]
@uri = URI.parse(@uri) unless @uri.is_a?(URI)
raise ArgumentError, "The source must be an absolute URI" unless @uri.absolute?
end
|
Instance Attribute Details
#uri ⇒ Object
Returns the value of attribute uri.
27
28
29
|
# File 'lib/bowline/bundler/source.rb', line 27
def uri
@uri
end
|
Instance Method Details
#==(other) ⇒ Object
44
45
46
|
# File 'lib/bowline/bundler/source.rb', line 44
def ==(other)
uri == other.uri
end
|
#can_be_local? ⇒ Boolean
36
37
38
|
# File 'lib/bowline/bundler/source.rb', line 36
def can_be_local?
false
end
|
#download(spec) ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/bowline/bundler/source.rb', line 54
def download(spec)
Bundler.logger.info "Downloading #{spec.full_name}.gem"
destination = bundle.gem_path
unless destination.writable?
raise RubygemsRetardation, "destination: #{destination} is not writable"
end
Gem::RemoteFetcher.fetcher.download(spec, uri, destination)
new_spec = Gem::Format.from_file_by_path(destination.join('cache', "#{spec.full_name}.gem")).spec
spec.__swap__(new_spec)
end
|
#gems ⇒ Object
40
41
42
|
# File 'lib/bowline/bundler/source.rb', line 40
def gems
@specs ||= fetch_specs
end
|
#to_s ⇒ Object
48
49
50
|
# File 'lib/bowline/bundler/source.rb', line 48
def to_s
@uri.to_s
end
|