Sha256: e95296fb8f6022ef5be1f27641d34f1c1efc7ed869ad820ac3d829de63b3830b

Contents?: true

Size: 702 Bytes

Versions: 2

Compression:

Stored size: 702 Bytes

Contents

module Compressors
  class Bzip2 < Base
    class << self
      def file_extension
        "bz2"
      end

      def compress(from, to = nil)
        to = case to
             when "-"
               "-c --stdout"
             when nil
               ""
             else
               "-c --stdout > #{to}"
             end

        "bzip2 #{from} #{to}"
      end

      def decompress(from, to = nil)
        from = "-f #{from}" unless from == "-"

        to = case to
             when "-"
               "-c --stdout"
             when nil
               ""
             else
               "-c --stdout > #{to}"
             end

        "bunzip2 -f #{from} #{to}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capistrano-db-tasks-0.6 lib/capistrano-db-tasks/compressors/bzip2.rb
capistrano-db-tasks-0.5 lib/capistrano-db-tasks/compressors/bzip2.rb