Class: LearnOpen::FileBackupStarter
- Inherits:
-
Object
- Object
- LearnOpen::FileBackupStarter
- Defined in:
- lib/learn_open/services/file_backup_starter.rb
Constant Summary collapse
- BACKUP_LAB_PROCESS =
"tail -f ~/inotify.log | while read change; do backup-lab; done"
Instance Attribute Summary collapse
-
#lesson ⇒ Object
readonly
Returns the value of attribute lesson.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#system_adapter ⇒ Object
readonly
Returns the value of attribute system_adapter.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(lesson, location, options) ⇒ FileBackupStarter
constructor
A new instance of FileBackupStarter.
Constructor Details
#initialize(lesson, location, options) ⇒ FileBackupStarter
Returns a new instance of FileBackupStarter.
12 13 14 15 16 |
# File 'lib/learn_open/services/file_backup_starter.rb', line 12 def initialize(lesson, location, ) @lesson = lesson @location = location @system_adapter = .fetch(:system_adapter, LearnOpen.system_adapter) end |
Instance Attribute Details
#lesson ⇒ Object (readonly)
Returns the value of attribute lesson.
6 7 8 |
# File 'lib/learn_open/services/file_backup_starter.rb', line 6 def lesson @lesson end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
6 7 8 |
# File 'lib/learn_open/services/file_backup_starter.rb', line 6 def location @location end |
#system_adapter ⇒ Object (readonly)
Returns the value of attribute system_adapter.
6 7 8 |
# File 'lib/learn_open/services/file_backup_starter.rb', line 6 def system_adapter @system_adapter end |
Class Method Details
.call(lesson, location, options) ⇒ Object
8 9 10 |
# File 'lib/learn_open/services/file_backup_starter.rb', line 8 def self.call(lesson, location, ) self.new(lesson, location, ).call end |
Instance Method Details
#call ⇒ Object
18 19 20 21 |
# File 'lib/learn_open/services/file_backup_starter.rb', line 18 def call system_adapter.spawn("restore-lab", block: true) system_adapter.spawn(BACKUP_LAB_PROCESS) end |