Class: Dumper::Database::Base
- Inherits:
-
Object
- Object
- Dumper::Database::Base
- Includes:
- Utility::ObjectFinder
- Defined in:
- lib/dumper/database/base.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#tmpdir ⇒ Object
Returns the value of attribute tmpdir.
Instance Method Summary collapse
- #dump_path ⇒ Object
- #dump_tool_path ⇒ Object
- #file_ext ⇒ Object
- #finalize ⇒ Object
-
#initialize(stack = nil) ⇒ Base
constructor
A new instance of Base.
Methods included from Utility::ObjectFinder
#find_instance_in_object_space
Constructor Details
#initialize(stack = nil) ⇒ Base
Returns a new instance of Base.
8 9 10 |
# File 'lib/dumper/database/base.rb', line 8 def initialize(stack = nil) @stack = stack end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
6 7 8 |
# File 'lib/dumper/database/base.rb', line 6 def filename @filename end |
#tmpdir ⇒ Object
Returns the value of attribute tmpdir.
6 7 8 |
# File 'lib/dumper/database/base.rb', line 6 def tmpdir @tmpdir end |
Instance Method Details
#dump_path ⇒ Object
16 17 18 |
# File 'lib/dumper/database/base.rb', line 16 def dump_path "#{tmpdir}/#{filename}" end |
#dump_tool_path ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dumper/database/base.rb', line 20 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 |
#file_ext ⇒ Object
12 13 14 |
# File 'lib/dumper/database/base.rb', line 12 def file_ext self.class::FILE_EXT end |
#finalize ⇒ Object
33 34 35 |
# File 'lib/dumper/database/base.rb', line 33 def finalize FileUtils.remove_entry_secure tmpdir if File.exist? tmpdir end |