Sha256: d413e261bc0ce0bef6b3d60513e0e001c0617990f23ac69bfb30e961e09e5010

Contents?: true

Size: 743 Bytes

Versions: 21

Compression:

Stored size: 743 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

21 entries across 21 versions & 5 rubygems

Version Path
astrails-safe-0.1.10 lib/astrails/safe/pgdump.rb
astrails-safe-0.1.7 lib/astrails/safe/pgdump.rb
astrails-safe-0.1.8 lib/astrails/safe/pgdump.rb
astrails-safe-0.1.9 lib/astrails/safe/pgdump.rb
astrails-safe-0.2.0 lib/astrails/safe/pgdump.rb
astrails-safe-0.2.1 lib/astrails/safe/pgdump.rb
astrails-safe-0.2.2 lib/astrails/safe/pgdump.rb
astrails-safe-0.2.3 lib/astrails/safe/pgdump.rb
bostonlogic-safe-0.3.0 lib/astrails/safe/pgdump.rb
astrails-safe-0.3.1 lib/astrails/safe/pgdump.rb
astrails-safe-0.3.0 lib/astrails/safe/pgdump.rb
netguru-safe-0.2.11 lib/astrails/safe/pgdump.rb
netguru-safe-0.2.10 lib/astrails/safe/pgdump.rb
netguru-safe-0.2.9 lib/astrails/safe/pgdump.rb
darkofabijan-astrails-safe-0.2.9 lib/astrails/safe/pgdump.rb
darkofabijan-astrails-safe-0.2.8 lib/astrails/safe/pgdump.rb
astrails-safe-0.2.7 lib/astrails/safe/pgdump.rb
astrails-safe-0.2.6 lib/astrails/safe/pgdump.rb
astrails-safe-0.2.5 lib/astrails/safe/pgdump.rb
webbynode-safe-0.2.5 lib/astrails/safe/pgdump.rb