Class: LearnOpen::FileBackupStarter

Inherits:
Object
  • Object
show all
Defined in:
lib/learn_open/services/file_backup_starter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lesson, location, options) ⇒ FileBackupStarter

Returns a new instance of FileBackupStarter.



9
10
11
12
13
# File 'lib/learn_open/services/file_backup_starter.rb', line 9

def initialize(lesson, location, options)
  @lesson = lesson
  @location = location
  @system_adapter = options.fetch(:system_adapter, LearnOpen.system_adapter)
end

Instance Attribute Details

#lessonObject (readonly)

Returns the value of attribute lesson.



3
4
5
# File 'lib/learn_open/services/file_backup_starter.rb', line 3

def lesson
  @lesson
end

#locationObject (readonly)

Returns the value of attribute location.



3
4
5
# File 'lib/learn_open/services/file_backup_starter.rb', line 3

def location
  @location
end

#system_adapterObject (readonly)

Returns the value of attribute system_adapter.



3
4
5
# File 'lib/learn_open/services/file_backup_starter.rb', line 3

def system_adapter
  @system_adapter
end

Class Method Details

.call(lesson, location, options) ⇒ Object



5
6
7
# File 'lib/learn_open/services/file_backup_starter.rb', line 5

def self.call(lesson, location, options)
  self.new(lesson, location, options).call
end

Instance Method Details

#callObject



15
16
17
18
# File 'lib/learn_open/services/file_backup_starter.rb', line 15

def call
  system_adapter.spawn("restore-lab", block: true)
  system_adapter.watch_dir("#{lesson.to_path}", "backup-lab")
end