Sha256: 65e88686bf3734796f26cc964925bbe1c313bd2ea8adb00c2e16486803fde664

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'

config_path = ARGV.shift.to_s.strip

if config_path.empty?
  STDERR.puts "Error: Configuration file required!"
  exit(1)
end

config = nil
begin
  config = ApplePush::Configuration.load_file(config_path)
rescue ArgumentError => ex
  STDERR.puts "Error: #{ex.message}"
  puts ex.backtrace
  exit(1)
end

EM.run do
  begin
    ApplePush.configure(config)
  rescue Exception => ex
    STDERR.puts "Error: #{ex.message}"
    exit(1)
  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.1 bin/apple_push