Class: EC2::Platform::Linux::Rsync::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2/platform/linux/rsync.rb

Constant Summary collapse

EXECUTABLE =
'rsync'

Instance Method Summary collapse

Constructor Details

#initialize(e = EXECUTABLE) ⇒ Command

Returns a new instance of Command.



18
19
20
21
22
23
24
# File 'lib/ec2/platform/linux/rsync.rb', line 18

def initialize(e = EXECUTABLE)
  @src   = nil
  @dst   = nil
  @options = []
  @executable = e
  @quiet = false
end

Instance Method Details

#archiveObject



26
# File 'lib/ec2/platform/linux/rsync.rb', line 26

def archive;        @options << '-rlpgoD';     self; end

#dereferenceObject



31
# File 'lib/ec2/platform/linux/rsync.rb', line 31

def dereference;    @options << '-L';          self; end

#dst(path) ⇒ Object Also known as: destination, to



35
# File 'lib/ec2/platform/linux/rsync.rb', line 35

def dst(path)       @dst = path;               self; end

#exclude(files) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/ec2/platform/linux/rsync.rb', line 43

def exclude(files)
  if files.is_a? Array
    files.each {|file| exclude file }
  else
    @options << "--exclude '#{files}'" unless files.nil?
  end
  self
end

#expandObject



61
62
63
# File 'lib/ec2/platform/linux/rsync.rb', line 61

def expand
  "#{@executable} #{@options.join(' ')} #{@src} #{@dst} #{'2>&1 > /dev/null' if @quiet}".strip
end

#include(files) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/ec2/platform/linux/rsync.rb', line 52

def include(files)
  if files.is_a? Array
    files.each {|file| include file }
  else
    @options << "--include '#{files}'" unless files.nil?
  end
  self
end


30
# File 'lib/ec2/platform/linux/rsync.rb', line 30

def links;          @options << '-l';          self; end

#quietlyObject



36
# File 'lib/ec2/platform/linux/rsync.rb', line 36

def quietly;        @quiet = true;             self; end

#recursiveObject



28
# File 'lib/ec2/platform/linux/rsync.rb', line 28

def recursive;      @options << '-r';          self; end

#sparseObject



29
# File 'lib/ec2/platform/linux/rsync.rb', line 29

def sparse;         @options << '-S';          self; end

#src(path) ⇒ Object Also known as: source, from



34
# File 'lib/ec2/platform/linux/rsync.rb', line 34

def src(path)       @src = path;               self; end

#timesObject



27
# File 'lib/ec2/platform/linux/rsync.rb', line 27

def times;          @options << '-t';          self; end

#versionObject



33
# File 'lib/ec2/platform/linux/rsync.rb', line 33

def version;        @options << '--version';   self; end

#xattributesObject



32
# File 'lib/ec2/platform/linux/rsync.rb', line 32

def xattributes;    @options << '-X';          self; end