Class: Siba::Source::Mysql::Init
- Inherits:
-
Object
- Object
- Siba::Source::Mysql::Init
- Includes:
- LoggerPlug
- Defined in:
- lib/siba-source-mysql/init.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
Returns the value of attribute db.
Instance Method Summary collapse
-
#backup(dest_dir) ⇒ Object
Collect source files and put them into dest_dir No return value is expected.
-
#initialize(options) ⇒ Init
constructor
A new instance of Init.
-
#restore(from_dir) ⇒ Object
Restore source files from_dir No return value is expected.
Constructor Details
#initialize(options) ⇒ Init
Returns a new instance of Init.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/siba-source-mysql/init.rb', line 29 def initialize() = {} OPTION_NAMES.each do |option_name| if MULTIPLE_CHOISES.include? option_name value = Siba::SibaCheck. , option_name.to_s, true else value = Siba::SibaCheck. , option_name.to_s, true if value.nil? # try get the setting from environment variable value = ENV["#{ENV_PREFIX}#{option_name.to_s.upcase}"] end end [option_name] = value end @db = Siba::Source::Mysql::Db.new end |
Instance Attribute Details
#db ⇒ Object
Returns the value of attribute db.
27 28 29 |
# File 'lib/siba-source-mysql/init.rb', line 27 def db @db end |
Instance Method Details
#backup(dest_dir) ⇒ Object
Collect source files and put them into dest_dir No return value is expected
49 50 51 52 |
# File 'lib/siba-source-mysql/init.rb', line 49 def backup(dest_dir) logger.info "Dumping MySQL#{db.db_and_table_names}" @db.backup dest_dir end |
#restore(from_dir) ⇒ Object
Restore source files from_dir No return value is expected
56 57 58 59 |
# File 'lib/siba-source-mysql/init.rb', line 56 def restore(from_dir) logger.info "Restoring MySQL#{db.db_and_table_names}" @db.restore from_dir end |