Sha256: 838e50a252b0d9fe6e44dde42e259da5009f4fa4751219133ff63929a7eacb02

Contents?: true

Size: 646 Bytes

Versions: 1

Compression:

Stored size: 646 Bytes

Contents

module Koine
  module DbBkp
    module Mysql
      class Dump
        def initialize(config = {})
          config = config.reject { |_k, v| ['', nil].include?(v) }

          @hostname = config[:hostname]
          @database = config.fetch(:database)
          @password = config[:password]
          @cli = Cli.new
        end

        def to_sql_file(file)
          parts = ['mysqldump']

          parts.push("-h #{@hostname}") if @hostname
          parts.push("-p#{@password}") if @password

          parts.push(@database)
          parts.push("> #{file}")

          @cli.execute(parts.join(' '))
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
koine-db_bkp-0.1.0 lib/koine/db_bkp/mysql/dump.rb