0
FileUtils.rm_rf destination rescue nil
0
+ d.local.expects_in_path(source.command)
0
+ d.local.expects_in_path(compress(nil, nil).first)
0
+ d.remote.expects_in_path(decompress(nil).first)
0
# Returns the basename of the release_path, which will be used to
0
# Returns the command necessary to compress the given directory
0
- # into the given file.
0
+ # into the given file. The command is returned as an array, where
0
+ # the first element is the utility to be used to perform the compression.
0
def compress(directory, file)
0
- when :gzip, :gz then "tar czf #{file} #{directory}"
0
- when :bzip2, :bz2 then "tar cjf #{file} #{directory}"
0
- when :zip then "zip -qr #{file} #{directory}"
0
+ when :gzip, :gz then ["tar", "czf", file, directory]
0
+ when :bzip2, :bz2 then ["tar", "cjf", file, directory]
0
+ when :zip then ["zip", "-qr", file, directory]
0
+ else raise ArgumentError, "invalid compression type #{compression.inspect}"
0
# Returns the command necessary to decompress the given file,
0
# relative to the current working directory. It must also
0
- # preserve the directory structure in the file.
0
+ # preserve the directory structure in the file. The command is returned
0
+ # as an array, where the first element is the utility to be used to
0
+ # perform the decompression.
0
- when :gzip, :gz then "tar xzf #{file}"
0
- when :bzip2, :bz2 then "tar xjf #{file}"
0
- when :zip then "unzip -q #{file}"
0
+ when :gzip, :gz then ["tar", "xzf", file]
0
+ when :bzip2, :bz2 then ["tar", "xjf", file]
0
+ when :zip then ["unzip", "-q", file]
0
+ else raise ArgumentError, "invalid compression type #{compression.inspect}"
Comments
No one has commented yet.