Class: DockerRailsProxy::Rsync::Sync

Inherits:
Object
  • Object
show all
Defined in:
lib/docker_rails_proxy/concerns/rsync.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rsync_host:) ⇒ Sync

Returns a new instance of Sync.



53
54
55
# File 'lib/docker_rails_proxy/concerns/rsync.rb', line 53

def initialize(rsync_host:)
  @rsync_host = rsync_host
end

Instance Attribute Details

#rsync_hostObject (readonly)

Returns the value of attribute rsync_host.



51
52
53
# File 'lib/docker_rails_proxy/concerns/rsync.rb', line 51

def rsync_host
  @rsync_host
end

Class Method Details

.call(rsync_host:, **options) ⇒ Object



57
58
59
# File 'lib/docker_rails_proxy/concerns/rsync.rb', line 57

def self.call(rsync_host:, **options)
  new(rsync_host: rsync_host).sync(options)
end

Instance Method Details

#sync(options) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/docker_rails_proxy/concerns/rsync.rb', line 61

def sync(options)
  source, target, volume = normalize_options(options)

  result = send "sync_#{volume}", source: source, target: target

  if result && options[:silent].eql?(false)
    puts "#{source}   =======>   #{target}"
  end

  result
end