Sha256: 5bf932c4ff68098832ba434b8bea923760a298764cdd3de6752b47e54764c4bb

Contents?: true

Size: 729 Bytes

Versions: 13

Compression:

Stored size: 729 Bytes

Contents

module Astrails
  module Safe
    class Mysqldump < Source

      def command
        "mysqldump --defaults-extra-file=#{mysql_password_file} #{@config[:options]} #{mysql_skip_tables} #{@id}"
      end

      def extension; '.sql'; end

      protected

      def mysql_password_file
        Astrails::Safe::TmpFile.create("mysqldump") do |file|
          file.puts "[mysqldump]"
          %w/user password socket host port/.each do |k|
            v = @config[k]
            file.puts "#{k} = #{v}" if v
          end
        end
      end

      def mysql_skip_tables
        if skip_tables = @config[:skip_tables]
          [*skip_tables].map { |t| "--ignore-table=#{@id}.#{t}" } * " "
        end
      end

    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
astrails-safe-0.1.10 lib/astrails/safe/mysqldump.rb
astrails-safe-0.1.7 lib/astrails/safe/mysqldump.rb
astrails-safe-0.1.8 lib/astrails/safe/mysqldump.rb
astrails-safe-0.1.9 lib/astrails/safe/mysqldump.rb
astrails-safe-0.2.0 lib/astrails/safe/mysqldump.rb
astrails-safe-0.2.1 lib/astrails/safe/mysqldump.rb
astrails-safe-0.2.2 lib/astrails/safe/mysqldump.rb
astrails-safe-0.2.3 lib/astrails/safe/mysqldump.rb
bostonlogic-safe-0.3.0 lib/astrails/safe/mysqldump.rb
astrails-safe-0.2.6 lib/astrails/safe/mysqldump.rb
astrails-safe-0.2.5 lib/astrails/safe/mysqldump.rb
webbynode-safe-0.2.5 lib/astrails/safe/mysqldump.rb
astrails-safe-0.2.4 lib/astrails/safe/mysqldump.rb