Class: Gem::RemoteFetcher
- Inherits:
-
Object
- Object
- Gem::RemoteFetcher
- Defined in:
- lib/rubygems_plugin.rb
Instance Method Summary collapse
- #download(spec, source_uri, install_dir = Gem.dir) ⇒ Object
- #download_without_s3 ⇒ Object
- #fetch_path(uri, mtime = nil, head = false) ⇒ Object
- #fetch_path_without_s3 ⇒ Object
- #fetch_s3(uri, mtime = nil, head = false) ⇒ Object
Instance Method Details
#download(spec, source_uri, install_dir = Gem.dir) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rubygems_plugin.rb', line 7 def download(spec, source_uri, install_dir = Gem.dir) unless source_uri.is_a?(URI::Generic) begin source_uri = URI.parse(source_uri) rescue source_uri = URI.parse(URI.const_defined?(:DEFAULT_PARSER) ? URI::DEFAULT_PARSER.escape(source_uri.to_s) : URI.escape(source_uri.to_s)) end end if source_uri.scheme == "s3" source_uri.scheme = "https" source_uri.path = "/hacky-s3-hack" + source_uri.path end download_without_s3(spec, source_uri, install_dir) end |
#download_without_s3 ⇒ Object
6 |
# File 'lib/rubygems_plugin.rb', line 6 alias_method :download_without_s3, :download |
#fetch_path(uri, mtime = nil, head = false) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/rubygems_plugin.rb', line 29 def fetch_path(uri, mtime = nil, head = false) uri = URI.parse uri unless URI::Generic === uri if uri.path.start_with?('/hacky-s3-hack') uri.path = uri.path.sub('/hacky-s3-hack', '') uri = Gem::S3.s3_to_https(uri) end fetch_path_without_s3(uri, mtime, head) end |
#fetch_path_without_s3 ⇒ Object
28 |
# File 'lib/rubygems_plugin.rb', line 28 alias_method :fetch_path_without_s3, :fetch_path |
#fetch_s3(uri, mtime = nil, head = false) ⇒ Object
24 25 26 |
# File 'lib/rubygems_plugin.rb', line 24 def fetch_s3(uri, mtime = nil, head = false) fetch_https Gem::S3.s3_to_https(uri), mtime, head end |