class EasySync::SyncRunner
Attributes
config[R]
Public Class Methods
new()
click to toggle source
# File lib/easy_sync/sync_runner.rb, line 8 def initialize() handle_config end
Public Instance Methods
run()
click to toggle source
# File lib/easy_sync/sync_runner.rb, line 12 def run config[:tasks].each do |c| c[:logging] = config[:logging] Rsync.new(c).sync end end
Private Instance Methods
generate_yaml(path)
click to toggle source
# File lib/easy_sync/sync_runner.rb, line 27 def generate_yaml(path) File.open(path, 'w') do |f| h = {:logging => :on, :tasks => [{ sync_name: "sample_sync", source: "[/example/path]", destination: "[/example/path]", exclude_file: "[/example/path]" }]} f.puts h.to_yaml end $stderr.puts "Generated sample config file: #{path}\n\n" end
handle_config()
click to toggle source
# File lib/easy_sync/sync_runner.rb, line 21 def handle_config path = "#{ENV["HOME"]}/.easy_syncrc.yml" generate_yaml(path) unless File.exist? path @config = YAML.load_file path end