Sha256: 9b61001b0f4565bccfcfe99080517d1b7fd7df89c41382e20b8002574f4ca72d
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
require 'fileutils' module Monsoon class Compress def initialize(backup) @backup = backup end # Run the Monsoon Compress process. # # Examples # # Monsoon::Compress(#<Monsoon::Backup>).run # # => #<Monsoon::Compress> # # Returns an instance of the Monsoon::Compress class def run Kernel.system "#{compress_command}" self end # Helper to form the tar compress command. # # Examples # # Monsoon::Compress(#<Monsoon::Backup>).compress_command # # => "tar -czf app_development_1234.tar.gz dump/app_development" # # Returns the command as a String. def compress_command "tar -czf #{filename} #{@backup.database}" end # Helper to form the tar compress command. # # Examples # # Monsoon::Compress(#<Monsoon::Backup>).filename # # => "app_development_1234.tar.gz" # # Returns the filename as a String. def filename @filename ||= "#{@backup.database}_#{Time.now.strftime('%Y%m%d_%H%M%S')}.tar.gz" end # Helper to delete the backup file once finished. # # Examples # # Monsoon::Compress(#<Monsoon::Backup>).clean # # => "app_development_1234.tar.gz" # # Returns results of the command. def clean FileUtils.rm filename, force: true end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
monsoon-0.6.1 | lib/monsoon/compress.rb |
monsoon-0.6 | lib/monsoon/compress.rb |
monsoon-0.5 | lib/monsoon/compress.rb |