Class: Siba::OptionsBackup
- Inherits:
-
Object
- Object
- Siba::OptionsBackup
- Extended by:
- FilePlug, LoggerPlug
- Defined in:
- lib/siba/options_backup.rb
Constant Summary collapse
- OPTIONS_BACKUP_FILE_NAME =
"siba_options_backup.yml"
Class Method Summary collapse
Methods included from LoggerPlug
close, create, logger, logger, opened?
Methods included from FilePlug
siba_file, siba_file, siba_file=
Class Method Details
.load_source_from_backup(dir) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/siba/options_backup.rb', line 20 def load_source_from_backup(dir) = File.join dir, OPTIONS_BACKUP_FILE_NAME = Siba::OptionsLoader.load_yml Siba.current_dir = SibaCheck. , "current_dir" unless siba_file.file_directory? Siba.current_dir begin siba_file.file_utils_mkpath Siba.current_dir rescue Exception logger.error "Can not access the backup current directory #{Siba.current_dir}" raise end end SibaTask.new , "source" end |
.save_options_backup(path_to_options, to_dir) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/siba/options_backup.rb', line 11 def (, to_dir) data = Siba::FileHelper.read data << "\n\ncurrent_dir: \"#{Siba::StringHelper.escape_for_yaml(Siba.current_dir)}\"" = File.join to_dir, OPTIONS_BACKUP_FILE_NAME siba_file.run_this do Siba::FileHelper.write , data end end |