Sha256: 07fc3ac2e295e17036ce86f374905d5b4cbd268c8a8143e719489c360ee0d07a

Contents?: true

Size: 734 Bytes

Versions: 1

Compression:

Stored size: 734 Bytes

Contents

module Astrails
  module Safe
    class Pgdump < Source

      def command
        if config["password"]
          ENV['PGPASSWORD'] = config["password"]
        else
          ENV['PGPASSWORD'] = nil
        end
        "pg_dump #{postgres_options} #{postgres_username} #{postgres_host} #{postgres_port} #{@id}"
      end

      def extension; '.sql'; end

      protected

      def postgres_options
        config[:options]
      end

      def postgres_host
        config["host"] && "--host='#{config["host"]}'"
      end

      def postgres_port
        config["port"] && "--port='#{config["port"]}'"
      end

      def postgres_username
        config["user"] && "--username='#{config["user"]}'"
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
akupchanko-astrails-safe-0.3.1 lib/astrails/safe/pgdump.rb