Class: Dumper::Database::Base
- Inherits:
-
Object
- Object
- Dumper::Database::Base
- Includes:
- Utility::ObjectFinder
- Defined in:
- lib/dumper/database/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#custom_options ⇒ Object
Returns the value of attribute custom_options.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#format ⇒ Object
Returns the value of attribute format.
-
#tmpdir ⇒ Object
Returns the value of attribute tmpdir.
Instance Method Summary collapse
Methods included from Utility::ObjectFinder
#find_instance_in_object_space
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/dumper/database/base.rb', line 6 def config @config end |
#custom_options ⇒ Object
Returns the value of attribute custom_options.
6 7 8 |
# File 'lib/dumper/database/base.rb', line 6 def @custom_options end |
#filename ⇒ Object
Returns the value of attribute filename.
6 7 8 |
# File 'lib/dumper/database/base.rb', line 6 def filename @filename end |
#format ⇒ Object
Returns the value of attribute format.
6 7 8 |
# File 'lib/dumper/database/base.rb', line 6 def format @format 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
12 13 14 |
# File 'lib/dumper/database/base.rb', line 12 def dump_path "#{tmpdir}/#{filename}" end |
#dump_tool_path ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dumper/database/base.rb', line 16 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
8 9 10 |
# File 'lib/dumper/database/base.rb', line 8 def file_ext (format || self.class::FORMAT) + '.gz' end |
#finalize ⇒ Object
29 30 31 |
# File 'lib/dumper/database/base.rb', line 29 def finalize FileUtils.remove_entry_secure(tmpdir) if tmpdir and File.exist?(tmpdir) end |