Module: PEBuild::Transfer
- Defined in:
- lib/pe_build/transfer.rb
Defined Under Namespace
Modules: File, OpenURI Classes: UnhandledURIScheme
Constant Summary collapse
- IMPLEMENTATIONS =
{ 'http' => PEBuild::Transfer::OpenURI, 'https' => PEBuild::Transfer::OpenURI, 'ftp' => PEBuild::Transfer::OpenURI, 'file' => PEBuild::Transfer::File, nil => PEBuild::Transfer::File, # Assume that URIs without a scheme are files }
Class Method Summary collapse
- .copy(src, dst) ⇒ Object
-
.read(src) ⇒ String
Return the contents of a local or remote file.
Class Method Details
.copy(src, dst) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pe_build/transfer.rb', line 21 def self.copy(src, dst) scheme = src.scheme if (mod = IMPLEMENTATIONS[scheme]) mod.copy(src, dst) else raise UnhandledURIScheme, :scheme => scheme, :supported => IMPLEMENTATIONS.keys end end |
.read(src) ⇒ String
Return the contents of a local or remote file.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/pe_build/transfer.rb', line 39 def self.read(src) scheme = src.scheme if (mod = IMPLEMENTATIONS[scheme]) mod.read(src) else raise UnhandledURIScheme, :scheme => scheme, :supported => IMPLEMENTATIONS.keys end end |