Class: CapistranoSyncTask::Dir

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/capistrano-sync/sync.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

#_capture, #check_deps, #get_ssh_command

Constructor Details

#initialize(cap, from, to) ⇒ Dir

Returns a new instance of Dir.



155
156
157
158
159
# File 'lib/capistrano-sync/sync.rb', line 155

def initialize(cap, from, to)
  self.from = from
  self.to   = to
  self.cap  = cap
end

Instance Attribute Details

#capObject

Returns the value of attribute cap.



154
155
156
# File 'lib/capistrano-sync/sync.rb', line 154

def cap
  @cap
end

#fromObject

Returns the value of attribute from.



154
155
156
# File 'lib/capistrano-sync/sync.rb', line 154

def from
  @from
end

#toObject

Returns the value of attribute to.



154
155
156
# File 'lib/capistrano-sync/sync.rb', line 154

def to
  @to
end

Instance Method Details

#syncObject



161
162
163
164
165
166
167
168
# File 'lib/capistrano-sync/sync.rb', line 161

def sync
  check_deps
  ssh_cmd, server = get_ssh_command
  log "rsync #{server}:#{from} -> local:#{to} (see progress)"
  cmd = "#{ssh_cmd} \"tar -cC #{from} .\" |pv -s #{total} | tar -x -C #{to}"
  cmd = [rsync_command, cat_files_command, pv_command, trash_output_command].join(" | ")
  system cmd
end