Class: Outback::Backup
- Includes:
- Logging
- Defined in:
- lib/outback/backup.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#tmpdir ⇒ Object
readonly
Returns the value of attribute tmpdir.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Backup
constructor
A new instance of Backup.
- #run! ⇒ Object
Methods included from Logging
Constructor Details
#initialize(configuration) ⇒ Backup
Returns a new instance of Backup.
7 8 9 10 11 12 |
# File 'lib/outback/backup.rb', line 7 def initialize(configuration) raise ArgumentError, "configuration required" unless configuration.is_a?(Outback::Configuration) @configuration = configuration @name = configuration.name @timestamp = Time.now.strftime(Outback::TIME_FORMAT) end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
5 6 7 |
# File 'lib/outback/backup.rb', line 5 def configuration @configuration end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/outback/backup.rb', line 5 def name @name end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
5 6 7 |
# File 'lib/outback/backup.rb', line 5 def @timestamp end |
#tmpdir ⇒ Object (readonly)
Returns the value of attribute tmpdir.
5 6 7 |
# File 'lib/outback/backup.rb', line 5 def tmpdir @tmpdir end |
Instance Method Details
#run! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/outback/backup.rb', line 14 def run! logger.info "Using working directory #{configuration.tmpdir}" if configuration.tmpdir @tmpdir = Dir.mktmpdir([name, ], configuration.tmpdir) archives = create_archives logger.info "Created #{archives.size} archives" archives = process_archives(archives) logger.info "Processed #{archives.size} archives" store_archives(archives) purge_targets ensure FileUtils.remove_entry_secure(tmpdir) end |