Module: NotifyPush

Defined in:
lib/notify-push.rb,
lib/notify-push/cli.rb,
lib/notify-push/sender.rb,
lib/notify-push/receiver.rb

Overview


MODULE->NOTIFY-PUSH —————————-


Defined Under Namespace

Modules: Receiver, Sender, Utility Classes: CLI

Constant Summary collapse

VERSION =

CONSTANTS ————————————


Gem.loaded_specs["notify-push"].version
CHANNEL_NAME =
"notify-push"
CONFIGURATION_FILE_PATH =
"#{ENV["HOME"]}/.notify-pushrc"

Class Method Summary collapse

Class Method Details

.initialize_configurationObject


USER-CONFIGURATION —————————




69
70
71
72
73
74
75
# File 'lib/notify-push.rb', line 69

def self.initialize_configuration()
  unless File.exist? CONFIGURATION_FILE_PATH
    raise "Configuration file does not exist at '#{CONFIGURATION_FILE_PATH}'."
  end

  self.configuration = RecursiveOpenStruct.new(YAML.load_file(CONFIGURATION_FILE_PATH))
end

.main(type, *args) ⇒ Object


MAIN —————————————–




87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/notify-push.rb', line 87

def self.main(type, *args)
  begin
    initialize_configuration

    case type
    when :receiver, :receive
      return NotifyPush::Receiver.start *args
    when :sender, :send
      return NotifyPush::Sender.send_notification *args
    end

  rescue => exception
    puts "fatal: #{exception.to_s}"
    exit 1
  end
end

.on_at_exitObject


CALLBACKS ————————————




80
81
82
# File 'lib/notify-push.rb', line 80

def self.on_at_exit
  self.acting_as.try(:on_at_exit)
end