Sha256: 066d4a3b096fa8990c8f123d8a82e8822472ac99f660c0e2b3d74ebd4b110521
Contents?: true
Size: 870 Bytes
Versions: 22
Compression:
Stored size: 870 Bytes
Contents
module Pansophy class Synchronizer def initialize(bucket_name, remote_directory, local_directory) @remote_dir = Remote::Directory.new(bucket_name, remote_directory) @local_dir = Local::Directory.new(local_directory) end def pull(options = {}) synchronize(@remote_dir, @local_dir, options) end def push(options = {}) synchronize(@local_dir, @remote_dir, options) end def merge(options = {}) synchronize(@remote_dir, @local_dir, options.merge(merge: true)) end private def synchronize(source_dir, destination_dir, options) destination_dir.create(options) unless options[:merge] source_dir.files.each do |file| file_path = Helpers::PathBuilder.new(file, source_dir).relative_path destination_dir.create_file(file_path, file.body, options) end end end end
Version data entries
22 entries across 22 versions & 1 rubygems