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.



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

def initialize(rsync_host:)
  @rsync_host = rsync_host
end

Instance Attribute Details

#rsync_hostObject (readonly)

Returns the value of attribute rsync_host.



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

def rsync_host
  @rsync_host
end

Class Method Details

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



62
63
64
# File 'lib/docker_rails_proxy/concerns/rsync.rb', line 62

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

Instance Method Details

#sync(options) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/docker_rails_proxy/concerns/rsync.rb', line 66

def sync(options)
  return if source_in_exclusions?(**options)

  source, target, volume = normalize_options(**options)

  result = send(
    "sync_#{volume}", source: source, target: target, reverse: options[:reverse]
  )

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

  result
end