class Pansophy::Synchronizer
Public Class Methods
new(bucket_name, remote_directory, local_directory)
click to toggle source
# File lib/pansophy/synchronizer.rb, line 3 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
Public Instance Methods
merge(options = {})
click to toggle source
# File lib/pansophy/synchronizer.rb, line 16 def merge(options = {}) synchronize(@remote_dir, @local_dir, options.merge(merge: true)) end
pull(options = {})
click to toggle source
# File lib/pansophy/synchronizer.rb, line 8 def pull(options = {}) synchronize(@remote_dir, @local_dir, options) end
push(options = {})
click to toggle source
# File lib/pansophy/synchronizer.rb, line 12 def push(options = {}) synchronize(@local_dir, @remote_dir, options) end
Private Instance Methods
synchronize(source_dir, destination_dir, options)
click to toggle source
# File lib/pansophy/synchronizer.rb, line 22 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