Sha256: 7c1871a1ab6b4b6b45eaddfba1dc8787f215e20b519738234eaaa47272f981eb

Contents?: true

Size: 708 Bytes

Versions: 1

Compression:

Stored size: 708 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 -k -f #{from} #{to}"
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-db-tasks.senya-0.4.1 lib/capistrano-db-tasks/compressors/bzip2.rb