Sha256: 71224dfb729db7f6d600ff1df2460189eb993115ffefc9679adffc5704e3d673

Contents?: true

Size: 819 Bytes

Versions: 21

Compression:

Stored size: 819 Bytes

Contents

module Dumper
  module Database
    class Base
      include Dumper::Utility::ObjectFinder

      attr_accessor :tmpdir, :filename, :config

      def file_ext
        self.class::FILE_EXT
      end

      def dump_path
        "#{tmpdir}/#{filename}"
      end

      def dump_tool_path
        tool = self.class::DUMP_TOOL
        path = `which #{tool}`.chomp
        if path.empty?
          # /usr/local/mysql/bin = OSX binary, /usr/local/bin = homebrew, /usr/bin = linux
          dir = [ '/usr/local/mysql/bin', '/usr/local/bin', '/usr/bin' ].find do |i|
            File.exist?("#{i}/#{tool}")
          end
          path = "#{dir}/#{tool}" if dir
        end
        path
      end

      def finalize
        FileUtils.remove_entry_secure(tmpdir) if tmpdir and File.exist?(tmpdir)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
dumper-1.5.0 lib/dumper/database/base.rb
dumper-1.4.5 lib/dumper/database/base.rb
dumper-1.4.4 lib/dumper/database/base.rb
dumper-1.4.3 lib/dumper/database/base.rb
dumper-1.4.2 lib/dumper/database/base.rb
dumper-1.4.1 lib/dumper/database/base.rb
dumper-1.4.0 lib/dumper/database/base.rb
dumper-1.3.7 lib/dumper/database/base.rb
dumper-1.3.6 lib/dumper/database/base.rb
dumper-1.3.5 lib/dumper/database/base.rb
dumper-1.3.4 lib/dumper/database/base.rb
dumper-1.3.3 lib/dumper/database/base.rb
dumper-1.3.2 lib/dumper/database/base.rb
dumper-1.3.1 lib/dumper/database/base.rb
dumper-1.3.0 lib/dumper/database/base.rb
dumper-1.2.1 lib/dumper/database/base.rb
dumper-1.2.0 lib/dumper/database/base.rb
dumper-1.1.3 lib/dumper/database/base.rb
dumper-1.1.2 lib/dumper/database/base.rb
dumper-1.1.1 lib/dumper/database/base.rb