Class: LiquidBackup::Job
- Inherits:
-
Object
- Object
- LiquidBackup::Job
- Defined in:
- lib/liquid_backup/job.rb,
lib/liquid_backup/job/modules/folder_module.rb,
lib/liquid_backup/job/modules/database_module.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#application_directory ⇒ Object
Returns the value of attribute application_directory.
-
#backups_path ⇒ Object
Returns the value of attribute backups_path.
-
#current_backup_path ⇒ Object
Returns the value of attribute current_backup_path.
-
#destination_handler ⇒ Object
Returns the value of attribute destination_handler.
-
#destination_location ⇒ Object
Returns the value of attribute destination_location.
-
#notifiers ⇒ Object
Returns the value of attribute notifiers.
-
#previous_backups_path ⇒ Object
Returns the value of attribute previous_backups_path.
-
#script_path ⇒ Object
Returns the value of attribute script_path.
Instance Method Summary collapse
- #application_name ⇒ Object
- #backup ⇒ Object
- #backup_size ⇒ Object
-
#initialize(script_path) ⇒ Job
constructor
A new instance of Job.
- #perform ⇒ Object
Methods included from Database
Methods included from Folder
Constructor Details
#initialize(script_path) ⇒ Job
Returns a new instance of Job.
21 22 23 24 25 26 27 28 |
# File 'lib/liquid_backup/job.rb', line 21 def initialize(script_path) @script_path = script_path @application_directory = script_path.gsub(/\/current\/config\/(.*).rb/,'') @backups_path = File.join(application_directory,'backups') @current_backup_path = File.join(backups_path,'current') @previous_backups_path = File.join(backups_path,'previous') @notifiers = {} end |
Instance Attribute Details
#application_directory ⇒ Object
Returns the value of attribute application_directory.
9 10 11 |
# File 'lib/liquid_backup/job.rb', line 9 def application_directory @application_directory end |
#backups_path ⇒ Object
Returns the value of attribute backups_path.
10 11 12 |
# File 'lib/liquid_backup/job.rb', line 10 def backups_path @backups_path end |
#current_backup_path ⇒ Object
Returns the value of attribute current_backup_path.
11 12 13 |
# File 'lib/liquid_backup/job.rb', line 11 def current_backup_path @current_backup_path end |
#destination_handler ⇒ Object
Returns the value of attribute destination_handler.
14 15 16 |
# File 'lib/liquid_backup/job.rb', line 14 def destination_handler @destination_handler end |
#destination_location ⇒ Object
Returns the value of attribute destination_location.
15 16 17 |
# File 'lib/liquid_backup/job.rb', line 15 def destination_location @destination_location end |
#notifiers ⇒ Object
Returns the value of attribute notifiers.
17 18 19 |
# File 'lib/liquid_backup/job.rb', line 17 def notifiers @notifiers end |
#previous_backups_path ⇒ Object
Returns the value of attribute previous_backups_path.
12 13 14 |
# File 'lib/liquid_backup/job.rb', line 12 def previous_backups_path @previous_backups_path end |
#script_path ⇒ Object
Returns the value of attribute script_path.
8 9 10 |
# File 'lib/liquid_backup/job.rb', line 8 def script_path @script_path end |
Instance Method Details
#application_name ⇒ Object
58 59 60 |
# File 'lib/liquid_backup/job.rb', line 58 def application_name application_directory.split("/")[-2] end |
#backup ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/liquid_backup/job.rb', line 39 def backup run_callbacks :backup do yield end run_callbacks :upload do upload end end |
#backup_size ⇒ Object
54 55 56 |
# File 'lib/liquid_backup/job.rb', line 54 def backup_size `du -sh #{current_backup_path}`.split("\t")[0] end |
#perform ⇒ Object
35 36 37 |
# File 'lib/liquid_backup/job.rb', line 35 def perform eval(File.read(script_path), binding) end |