lib/datapimp/sync/s3_bucket.rb in datapimp-1.0.26 vs lib/datapimp/sync/s3_bucket.rb in datapimp-1.0.27
- old
+ new
@@ -122,18 +122,24 @@
end
def run_pull_action(options={})
directories = Datapimp::Sync.amazon.storage.directories
bucket = directories.get(remote)
+ options = options.to_mash
+ if options.reset == true
+ FileUtils.rm_rf(local_path)
+ FileUtils.mkdir_p(local_path)
+ end
+
bucket.files.each do |file|
local_file = local_path.join(file.key)
next if local_file.exist? && file.etag == Digest::MD5.hexdigest(local_file.read)
FileUtils.mkdir_p(local_file.dirname)
- local_file.open("w+") {|fh| log("Updating docs entry") ;fh.write(file.body) }
+ local_file.open("w+") {|fh| log("Updated #{ file.key }"); fh.write(file.body) }
end
end
def run_create_action(options={})
directories = Datapimp::Sync.amazon.storage.directories
@@ -155,12 +161,12 @@
if action == :push
run_push_action(options)
elsif action == :create
run_create_action(options)
elsif action == :update_acl
- run_update_acl_action(options={})
+ run_update_acl_action(options)
elsif action == :pull
- run_pull_action
+ run_pull_action(options)
end
end
end
end
end