Module: Tartlet
- Defined in:
- lib/tartlet.rb,
lib/tartlet/version.rb
Constant Summary collapse
- OUTFILE =
"archive"
- TARGET =
"."
- VERSION =
"0.0.3"
Class Method Summary collapse
- .compressSingle(files, zip = true, target = OUTFILE) ⇒ Object
- .extractSingle(file, zip = true, target = TARGET) ⇒ Object
- .listSingle(file, zip = true) ⇒ Object
Class Method Details
.compressSingle(files, zip = true, target = OUTFILE) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/tartlet.rb', line 22 def Tartlet.compressSingle(files, zip = true, target = OUTFILE) # Add the .tar if it's not there target += ".tar" if target[/(\.tar)(\.gz)?\z/].nil? # Add the .gz if it's not there and we're zipping target += ".gz" if target[/\.(gz)\z/].nil? and zip # Generate the command command = "tar -c#{zip ? 'z' : ''}f #{target} #{files.join(' ')}" # Output or Run return command end |
.extractSingle(file, zip = true, target = TARGET) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/tartlet.rb', line 8 def Tartlet.extractSingle(file, zip = true, target = TARGET) # Generate the command command = "tar -x#{zip ? 'z' : ''}f #{file}" # Add the new target destination command += " -C #{target}" unless target == "." # Output or Run return command end |
.listSingle(file, zip = true) ⇒ Object
37 38 39 |
# File 'lib/tartlet.rb', line 37 def Tartlet.listSingle(file, zip = true) return "tar -#{zip ? 'z' : ''}tvf #{file}" end |