In Files
Included Modules
- ZLibUtils
Information
Class Index
![show/hide quicksearch [+]](../assets/icon/find.png)
- Ratch
- Ratch::Batch
- Ratch::CLI
- Ratch::ConfigUtils
- Ratch::Console
- Ratch::EmailUtils
- Ratch::Emailer
- Ratch::FTPUtils
- Ratch::FileList
- Ratch::FileNotFound
- Ratch::Help
- Ratch::POMUtils
- Ratch::RDocUtils
- Ratch::Script
- Ratch::Shell
- Ratch::System
- Ratch::TarUtils
- Ratch::XDGUtils
- Ratch::ZlibUtils
- FileTest
- Hash
- NilClass
- Object
- String
TarUtils
Utility methods for working with tarballs archives.
Public Class Methods
Public Instance Methods
tar(folder, file=nil, options={})
click to toggle source
Tar
# File lib/ratch/utils/tar.rb, line 25
25: def tar(folder, file=nil, options={})
26: noop, verbose = *util_options(options)
27: file ||= File.basename(File.expand_path(folder)) + '.tar'
28: cmd = "tar -cf #{file} #{folder}"
29: puts cmd if verbose
30: unless noop
31: locally do
32: gzIO = File.open(file, 'wb')
33: Archive::Tar::Minitar.pack(folder, gzIO)
34: end
35: end
36: path(file)
37: end
tar_gzip(folder, file=nil, options={})
click to toggle source
Tar Gzip
# File lib/ratch/utils/tar.rb, line 55
55: def tar_gzip(folder, file=nil, options={})
56: noop, verbose = *util_options(options)
57: file ||= File.basename(File.expand_path(folder)) + '.tar.gz' # '.tgz' which ?
58: cmd = "tar --gzip -czf #{file} #{folder}"
59: puts cmd if verbose
60: unless noop
61: locally do #folder, file = localize(folder), localize(file)
62: gzIO = Zlib::GzipWriter.new(File.open(file, 'wb'))
63: Archive::Tar::Minitar.pack(folder, gzIO)
64: end
65: end
66: path(file)
67: end
Also aliased as: tar_z
untar(file, options={})
click to toggle source
Untar
# File lib/ratch/utils/tar.rb, line 40
40: def untar(file, options={})
41: noop, verbose = *util_options(options)
42: #file ||= File.basename(File.expand_path(folder)) + '.tar'
43: cmd = "untar #{file}"
44: puts cmd if verbose
45: unless noop
46: locally do
47: gzIO = File.open(file, 'wb')
48: Archive::Tar::Minitar.unpack(gzIO)
49: end
50: end
51: path(file)
52: end
untar_gzip(file, options={})
click to toggle source
Untar Gzip
FIXME: Write unified untar_gzip function.
# File lib/ratch/utils/tar.rb, line 74
74: def untar_gzip(file, options={})
75: untar(ungzip(file, options), options)
76: end
Also aliased as: untar_z
Disabled; run with --debug to generate this.