Class: PEBuild::Transfer::OpenURI
- Inherits:
-
Object
- Object
- PEBuild::Transfer::OpenURI
- Includes:
- Idempotent
- Defined in:
- lib/pe_build/transfer/open_uri.rb
Defined Under Namespace
Classes: DownloadFailed
Constant Summary collapse
Instance Method Summary collapse
- #copy ⇒ Object
-
#initialize(uri, dst) ⇒ OpenURI
constructor
A new instance of OpenURI.
Methods included from Idempotent
Constructor Details
#initialize(uri, dst) ⇒ OpenURI
Returns a new instance of OpenURI.
15 16 17 18 19 |
# File 'lib/pe_build/transfer/open_uri.rb', line 15 def initialize(uri, dst) @uri, @dst = uri, dst @logger = Log4r::Logger.new('vagrant::pe_build::transfer::open_uri') end |
Instance Method Details
#copy ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/pe_build/transfer/open_uri.rb', line 23 def copy idempotent(@dst) do tmpfile = download_file FileUtils.mv(tmpfile, @dst) end rescue StandardError => e raise DownloadFailed, :uri => @uri, :msg => e. end |