Sha256: d2cc93e05beeb5c56958b1a67dd60b9847566964c59a289a303ce350c30afafd

Contents?: true

Size: 795 Bytes

Versions: 1

Compression:

Stored size: 795 Bytes

Contents

#!/usr/bin/env ruby

lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)

require 'eventmachine'
require 'thin'
require 'apple_push'

def terminate(message, exit_code=1)
  STDERR.puts(message)
  exit(exit_code)
end

config_path = ARGV.shift.to_s.strip

if config_path.empty?
  terminate("Configuration file required!")
end

config = nil

begin
  config = ApplePush::Configuration.load_file(config_path)
rescue StandardError => ex
  terminate(ex.message)
end

EM.run do
  begin
    ApplePush.configure(config)
  rescue StandardError => ex
    terminate(ex.message)
  end
  
  host = ApplePush.configuration[:host]
  port = ApplePush.configuration[:port]
  
  Thin::Server.start(ApplePush::Server, host, port)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
apple_push-0.1.2 bin/apple_push