lib/pe_build/transfer/file.rb in vagrant-pe_build-0.2.0 vs lib/pe_build/transfer/file.rb in vagrant-pe_build-0.3.0
- old
+ new
@@ -1,18 +1,20 @@
require 'fileutils'
+require 'pe_build/idempotent'
-module PEBuild
-module Transfer
-class File
+class PEBuild::Transfer::File
- # @param src [String] The path to the file to copy
+ # @param src [URI] The local file path path to the file to copy
# @param dst [String] The path to destination of the copied file
- def initialize(src, dst)
- @src, @dst = src, dst
+ def initialize(uri, dst)
+ @src = uri.path
+ @dst = dst
+
+ @logger = Log4r::Logger.new('vagrant::pe_build::transfer::file')
end
+ include PEBuild::Idempotent
+
def copy
- FileUtils.cp @src, @dst
+ idempotent(@dst) { FileUtils.cp @src, @dst }
end
-end
-end
end