Class: Cfruby::FileOps::RsyncFileCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/libcfruby/fileops.rb

Overview

FileCommand interface for rsync operations

Instance Method Summary collapse

Instance Method Details

#copy(filename, newfilename, options = {}) ⇒ Object

Options:

:archive

Equivilant to -a in the rsync command

:recursive

Recursive

:flags

Passed directly to the rsync command



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/libcfruby/fileops.rb', line 237

def copy(filename, newfilename, options = {})
  flags = Array.new()
  if(options[:flags])
    flags << options[:flags]
  end
  
  if(options[:archive])
    flags << "-a"
  end
  
  if(options[:recursive])
    flags << "-r"
  end
  
  rsynccommand = "rsync #{flags.join(' ')} #{filename} #{newfilename}"
  Cfruby.controller.attempt(rsynccommand, 'destructive', 'unknown') {
    Cfruby::Exec.exec(rsynccommand)
  }
end

#move(filename, newfilename, options = {}) ⇒ Object

Options:

:user

The user to use on the remote side

:archive

Equivilant to -a in the rsync command

:recursive

Recursive

:flags

Passed directly to the rsync command



229
230
# File 'lib/libcfruby/fileops.rb', line 229

def move(filename, newfilename, options = {})
end