Class: Backup
- Inherits:
-
Object
- Object
- Backup
- Defined in:
- lib/travis-backup.rb,
lib/backup/move_logs.rb,
lib/backup/remove_old.rb,
lib/backup/remove_orphans.rb
Overview
main travis-backup class
Defined Under Namespace
Classes: MoveLogs, RemoveOld, RemoveOrphans
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #dry_run_report ⇒ Object
-
#initialize(config_args = {}) ⇒ Backup
constructor
A new instance of Backup.
- #run(args = {}) ⇒ Object
Constructor Details
#initialize(config_args = {}) ⇒ Backup
26 27 28 29 30 31 32 33 |
# File 'lib/travis-backup.rb', line 26 def initialize(config_args={}) @config = Config.new(config_args) @db_helper = DbHelper.new(@config) if @config.dry_run @dry_run_reporter = DryRunReporter.new end end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
24 25 26 |
# File 'lib/travis-backup.rb', line 24 def config @config end |
Instance Method Details
#dry_run_report ⇒ Object
35 36 37 |
# File 'lib/travis-backup.rb', line 35 def dry_run_report @dry_run_reporter.report end |
#run(args = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/travis-backup.rb', line 39 def run(args={}) if @config.move_logs Backup::MoveLogs.new(@config, @db_helper, @dry_run_reporter).run elsif @config.remove_orphans Backup::RemoveOrphans.new(@config, @dry_run_reporter).run else Backup::RemoveOld.new(@config, @dry_run_reporter).run(args) end @dry_run_reporter.print_report if @config.dry_run end |