Module: NotifyPush

Defined in:
lib/notify-push.rb

Overview


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


Defined Under Namespace

Modules: Receiver, Sender

Constant Summary collapse

CHANNEL_NAME =

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


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

Class Method Summary collapse

Class Method Details

.initialize_configurationObject


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




30
31
32
33
34
35
36
# File 'lib/notify-push.rb', line 30

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

.mainObject


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




41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/notify-push.rb', line 41

def self.main()
  begin
    initialize_configuration

    if ["--receiver", "-r"].member? ARGV[0]
      return NotifyPush::Receiver.start
    end

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