Sha256: 7c8030ce14ce0642fc20b3dfecf6d24dcec60e687ed81edea89f627890c30654

Contents?: true

Size: 637 Bytes

Versions: 1

Compression:

Stored size: 637 Bytes

Contents

# frozen_string_literal: true
module LearnOpen
  class FileBackupStarter
    BACKUP_LAB_PROCESS = "tail -f ~/inotify.log | while read change do; backup-lab; done"

    attr_reader :lesson, :location, :system_adapter

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

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

    def call
      system_adapter.spawn("restore-lab", block: true)
      system_adapter.spawn(BACKUP_LAB_PROCESS)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
learn-open-1.2.27 lib/learn_open/services/file_backup_starter.rb