Class: EC2::Platform::Linux::Tar::Command
- Inherits:
-
Object
- Object
- EC2::Platform::Linux::Tar::Command
- Defined in:
- lib/ec2/platform/linux/tar.rb
Direct Known Subclasses
Constant Summary collapse
Instance Method Summary collapse
- #add(filename, dir = nil) ⇒ Object
- #archive(filename) ⇒ Object
- #bzip2 ⇒ Object
- #chdir(dir) ⇒ Object
- #create ⇒ Object
- #dereference ⇒ Object
- #diff ⇒ Object
- #expand ⇒ Object
- #extract ⇒ Object
- #group(grp) ⇒ Object
- #gzip ⇒ Object
-
#initialize(e = EXECUTABLE) ⇒ Command
constructor
A new instance of Command.
- #owner(user) ⇒ Object
- #sparse ⇒ Object
- #update ⇒ Object
- #verbose ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(e = EXECUTABLE) ⇒ Command
Returns a new instance of Command.
18 19 20 21 22 |
# File 'lib/ec2/platform/linux/tar.rb', line 18 def initialize(e = EXECUTABLE) @files = [] @options = [] @executable = e end |
Instance Method Details
#add(filename, dir = nil) ⇒ Object
56 57 58 59 60 |
# File 'lib/ec2/platform/linux/tar.rb', line 56 def add(filename, dir = nil) item = dir.nil? ? filename : "-C #{dir} #{filename}" @files << item self end |
#archive(filename) ⇒ Object
35 36 37 38 39 |
# File 'lib/ec2/platform/linux/tar.rb', line 35 def archive(filename) filename = '-' if filename.nil? @options << "-f #{filename}" self end |
#bzip2 ⇒ Object
27 |
# File 'lib/ec2/platform/linux/tar.rb', line 27 def bzip2; @options << '-j'; self; end |
#chdir(dir) ⇒ Object
51 52 53 54 |
# File 'lib/ec2/platform/linux/tar.rb', line 51 def chdir(dir) @options << "-C #{dir}" unless dir.nil? self end |
#create ⇒ Object
26 |
# File 'lib/ec2/platform/linux/tar.rb', line 26 def create; @options << '-c'; self; end |
#dereference ⇒ Object
33 |
# File 'lib/ec2/platform/linux/tar.rb', line 33 def dereference; @options << '-h'; self; end |
#diff ⇒ Object
28 |
# File 'lib/ec2/platform/linux/tar.rb', line 28 def diff; @options << '-d'; self; end |
#expand ⇒ Object
61 62 63 |
# File 'lib/ec2/platform/linux/tar.rb', line 61 def "#{@executable} #{@options.join(' ')} #{@files.join(' ')}".strip end |
#extract ⇒ Object
30 |
# File 'lib/ec2/platform/linux/tar.rb', line 30 def extract; @options << '-x'; self; end |
#group(grp) ⇒ Object
46 47 48 49 |
# File 'lib/ec2/platform/linux/tar.rb', line 46 def group(grp) @options << "--group #{grp}" self end |
#gzip ⇒ Object
29 |
# File 'lib/ec2/platform/linux/tar.rb', line 29 def gzip; @options << '-z'; self; end |
#owner(user) ⇒ Object
41 42 43 44 |
# File 'lib/ec2/platform/linux/tar.rb', line 41 def owner(user) @options << "--owner #{user}" self end |
#sparse ⇒ Object
32 |
# File 'lib/ec2/platform/linux/tar.rb', line 32 def sparse; @options << '-S'; self; end |
#update ⇒ Object
31 |
# File 'lib/ec2/platform/linux/tar.rb', line 31 def update; @options << '-u'; self; end |
#verbose ⇒ Object
25 |
# File 'lib/ec2/platform/linux/tar.rb', line 25 def verbose; @options << '-v'; self; end |
#version ⇒ Object
24 |
# File 'lib/ec2/platform/linux/tar.rb', line 24 def version; @options << '--version'; self; end |