Class: EC2::Platform::Linux::Rsync::Command
- Inherits:
-
Object
- Object
- EC2::Platform::Linux::Rsync::Command
- Defined in:
- lib/ec2/platform/linux/rsync.rb
Constant Summary collapse
- EXECUTABLE =
'rsync'
Instance Method Summary collapse
- #archive ⇒ Object
- #dereference ⇒ Object
- #dst(path) ⇒ Object (also: #destination, #to)
- #exclude(files) ⇒ Object
- #expand ⇒ Object
- #include(files) ⇒ Object
-
#initialize(e = EXECUTABLE) ⇒ Command
constructor
A new instance of Command.
- #links ⇒ Object
- #quietly ⇒ Object
- #recursive ⇒ Object
- #sparse ⇒ Object
- #src(path) ⇒ Object (also: #source, #from)
- #times ⇒ Object
- #version ⇒ Object
- #xattributes ⇒ Object
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
#archive ⇒ Object
26 |
# File 'lib/ec2/platform/linux/rsync.rb', line 26 def archive; @options << '-rlpgoD'; self; end |
#dereference ⇒ Object
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 |
#expand ⇒ Object
61 62 63 |
# File 'lib/ec2/platform/linux/rsync.rb', line 61 def "#{@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 |
#links ⇒ Object
30 |
# File 'lib/ec2/platform/linux/rsync.rb', line 30 def links; @options << '-l'; self; end |
#quietly ⇒ Object
36 |
# File 'lib/ec2/platform/linux/rsync.rb', line 36 def quietly; @quiet = true; self; end |
#recursive ⇒ Object
28 |
# File 'lib/ec2/platform/linux/rsync.rb', line 28 def recursive; @options << '-r'; self; end |
#sparse ⇒ Object
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 |
#times ⇒ Object
27 |
# File 'lib/ec2/platform/linux/rsync.rb', line 27 def times; @options << '-t'; self; end |
#version ⇒ Object
33 |
# File 'lib/ec2/platform/linux/rsync.rb', line 33 def version; @options << '--version'; self; end |
#xattributes ⇒ Object
32 |
# File 'lib/ec2/platform/linux/rsync.rb', line 32 def xattributes; @options << '-X'; self; end |