class GitFyncy::Remote

Public Class Methods

new(logger, remote, path, rsync_args) click to toggle source
# File lib/git-fyncy/remote.rb, line 7
def initialize(logger, remote, path, rsync_args)
  @logger = logger
  @remote = remote
  @path = slashify path
  @rsync_flags = rsync_args.join(" ")

  # COMMANDS
  @rm_cmd = "cd #{@path}; rm -f %{paths}"
  @rm_cmd = "ssh #{@remote} '#{@rm_cmd}'" if @remote
  path = @remote ? "#{@remote}:#{@path}" : @path
  @rsync_cmd = "rsync -zpR --checksum #{@rsync_flags} %{paths} #{path}"
end

Public Instance Methods

command(cmd, paths) click to toggle source
# File lib/git-fyncy/remote.rb, line 20
def command(cmd, paths)
  return if paths.empty?
  cmd = cmd % {paths: paths.to_a.join(' ')}
  @logger.log cmd
  system cmd
end
rm(paths) click to toggle source
# File lib/git-fyncy/remote.rb, line 31
def rm(paths)
  command @rm_cmd, paths
end
rsync(paths) click to toggle source
# File lib/git-fyncy/remote.rb, line 27
def rsync(paths)
  command @rsync_cmd, paths
end