Sha256: 697efd83fa3573c252a43afefaaf8196962dadeaf1e8f1379c210cdc4fd853a4

Contents?: true

Size: 517 Bytes

Versions: 1

Compression:

Stored size: 517 Bytes

Contents

require 'notifier'

module Riserva::Listeners
  class Backup < ApplicationListener
    def initialize
      notify('Starting backup...')
    end

    def ok
      notify('Backup successfully completed')
    end

    def failed
      notify('Backup failed')
    end

    private

    def notify(message)
      return unless enabled?
      Notifier.notify(image: 'media-floppy-symbolic', title: 'Riserva', message: message)
    end

    def enabled?
      Riserva::Config.read('system_notifications')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
riserva-0.1.0 lib/riserva/listeners/backup.rb