Skip to content

Instantly share code, notes, and snippets.

@kdonovan
Created June 17, 2011 01:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdonovan/1030667 to your computer and use it in GitHub Desktop.
Save kdonovan/1030667 to your computer and use it in GitHub Desktop.
Contents of the file apn_sender's generator puts in script/apn_sender (for those on Rails 3, where the generator isn't working yet)
#!/usr/bin/env ruby
# Daemons sets pwd to /, so we have to explicitly set RAILS_ROOT
RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
require 'rubygems'
require 'apn'
require 'apn/sender_daemon'
APN::SenderDaemon.new(ARGV).daemonize
@kdonovan
Copy link
Author

apn_sender's generator isn't yet Rails 3 compatible. In the meantime, follow these steps:

  1. Create a new file: script/apn_sender
  2. Paste in the contents of this gist
  3. Profit?

@mattvv
Copy link

mattvv commented Jun 17, 2011

Thanks for this kdonovan!
I've been using the rake task with mixed success i'll try this out :)

@sukeerthiadiga
Copy link

before require we need add on more line

require File.expand_path('../../config/application', FILE)
or else it says no such file to load -- apn (LoadError)

@dysto93
Copy link

dysto93 commented Dec 21, 2012

what is the format for apn_sender ? apn_sender.rb ? or other ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment