pushr-core 1.0.0.pre.1 → 1.0.0.pre.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +40 -62
- data/bin/pushr +38 -23
- data/lib/pushr/configuration.rb +2 -1
- data/lib/pushr/daemon.rb +18 -33
- data/lib/pushr/daemon/app.rb +1 -1
- data/lib/pushr/daemon/{delivery_handler.rb → message_handler.rb} +2 -2
- data/lib/pushr/daemon/pid_file.rb +21 -0
- data/lib/pushr/daemon/settings.rb +19 -0
- data/lib/pushr/feedback.rb +1 -1
- data/lib/pushr/message.rb +1 -1
- data/lib/pushr/version.rb +1 -1
- data/spec/lib/pushr/daemon/app_spec.rb +1 -1
- data/spec/lib/pushr/daemon/{delivery_handler_spec.rb → message_handler_spec.rb} +3 -3
- data/spec/spec_helper.rb +1 -2
- metadata +11 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c4520c42719fbd129a5e29c3c37a66769c57e8f
|
4
|
+
data.tar.gz: 95c79b3d1e565ee7e8a9a35c75a65cc88c1ea7a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 632e2d3cd972ce3301f600a61b5cb905408e79eeff51f32793be97c31e47f8914135f27f32f174cb035a9ce750601a6b7e53861ad5e5597afb82f3e0124f7192
|
7
|
+
data.tar.gz: 17e5e36b3c6bd2c250843f10cf747fbdbfc3ebd03fa9a7db7e1bc665330655d47161c852cfefbda15f1f9f48a1f9f6b0addb00045331c866c768827778eff7c2
|
data/README.md
CHANGED
@@ -1,72 +1,64 @@
|
|
1
1
|
# Pushr
|
2
2
|
|
3
|
+
Please note: We're in the process of updating this gem. The current code is not yet stable. Please contact us if you
|
4
|
+
want to test or contribute to this project.
|
5
|
+
|
3
6
|
[](https://travis-ci.org/9to5/pushr-core)
|
4
7
|
[](https://codeclimate.com/github/9to5/pushr-core)
|
5
8
|
[](https://coveralls.io/r/9to5/pushr-core)
|
6
9
|
|
7
10
|
## Features
|
8
11
|
|
12
|
+
* Lightening fast push notification delivery
|
13
|
+
* Redis for queueing
|
9
14
|
* Multi-App
|
10
|
-
* Multi-Provider ([APNS](https://github.com/
|
15
|
+
* Multi-Provider ([APNS](https://github.com/9to5/pushr-apns), [GCM](https://github.com/9to5/pushr-gcm))
|
11
16
|
* Integrated feedback processing
|
12
|
-
*
|
13
|
-
* Database for storage (no external dependencies)
|
17
|
+
* Multi-process
|
14
18
|
|
15
19
|
## Installation
|
16
20
|
|
17
|
-
Add to your `
|
21
|
+
Add to your `Gemfile`
|
18
22
|
|
19
|
-
gem '
|
23
|
+
gem 'pushr-core'
|
20
24
|
|
21
25
|
and add the push provider to you Gemfile:
|
22
26
|
|
23
27
|
For __APNS__ (iOS: Apple Push Notification Services):
|
24
28
|
|
25
|
-
gem '
|
26
|
-
|
27
|
-
For __C2DM__ (Android: Cloud to Device Messaging, deprecated by Google, not this gem):
|
28
|
-
|
29
|
-
gem 'push-c2dm'
|
29
|
+
gem 'pushr-apns'
|
30
30
|
|
31
31
|
For __GCM__ (Android: Google Cloud Messaging):
|
32
32
|
|
33
|
-
gem '
|
33
|
+
gem 'pushr-gcm'
|
34
34
|
|
35
35
|
And run `bundle install` to install the gems.
|
36
36
|
|
37
|
-
To generate the migration and the configuration files run:
|
38
|
-
|
39
|
-
rails g push
|
40
|
-
bundle exec rake db:migrate
|
41
|
-
|
42
37
|
## Configuration
|
43
38
|
|
44
|
-
|
39
|
+
By default the gem tries to connect to a Redis instance at localhost. If you define the `PUSHR_URL` environment variable
|
40
|
+
it will use that. The configuration is stored in Redis and you add the configuration per push provider with the console
|
41
|
+
(`bundle console`):
|
45
42
|
|
46
|
-
APNS ([see](https://github.com/
|
43
|
+
APNS ([see](https://github.com/9to5/pushr-core#generating-certificates)):
|
47
44
|
```ruby
|
48
45
|
Pushr::ConfigurationApns.create(app: 'app_name', connections: 2, enabled: true,
|
49
|
-
certificate: File.read('certificate.pem'),
|
50
|
-
feedback_poll: 60,
|
51
|
-
sandbox: false)
|
46
|
+
certificate: File.read('certificate.pem'), feedback_poll: 60, sandbox: false)
|
52
47
|
```
|
53
48
|
|
54
|
-
The `skip_check_for_error` parameter is optional and can be set to `true` or `false`. If set to `true` the APNS service
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
Pushr::ConfigurationC2dm.create(app: 'app_name', connections: 2, enabled: true,
|
59
|
-
email: '<email address here>',
|
60
|
-
password: '<password here>')
|
61
|
-
```
|
49
|
+
The `skip_check_for_error` parameter is optional and can be set to `true` or `false`. If set to `true` the APNS service
|
50
|
+
will not check for errors when sending messages. This option should be used in a production environment and improves
|
51
|
+
performance. In production the errors are reported and handled by the feedback service. Please note that if you use
|
52
|
+
sandbox devices in your production environment you should not `skip_check_for_error`.
|
62
53
|
|
63
54
|
GCM ([see](http://developer.android.com/guide/google/gcm/gs.html)):
|
64
55
|
```ruby
|
65
|
-
Pushr::ConfigurationGcm.create(app: 'app_name', connections: 2, enabled: true,
|
66
|
-
key: '<api key here>')
|
56
|
+
Pushr::ConfigurationGcm.create(app: 'app_name', connections: 2, enabled: true, api: '<api key here>')
|
67
57
|
```
|
68
58
|
|
69
|
-
You can have each provider per app_name and you can have more than one app_name. Use the instructions below to generate
|
59
|
+
You can have each provider per app_name and you can have more than one app_name. Use the instructions below to generate
|
60
|
+
the certificate for the APNS provider. If you only want to prepare the database with the configurations, you can set the
|
61
|
+
`enabled` switch to `false`. Only enabled configurations will be used by the daemon.
|
70
62
|
|
71
63
|
### Generating Certificates for APNS
|
72
64
|
|
@@ -76,7 +68,8 @@ You can have each provider per app_name and you can have more than one app_name.
|
|
76
68
|
4. Right click and select `Export 2 items...`.
|
77
69
|
5. Save the file as `cert.p12`, make sure the File Format is `Personal Information Exchange (p12)`.
|
78
70
|
6. If you decide to set a password for your exported certificate, please read the Configuration section below.
|
79
|
-
7. Convert the certificate to a .pem, where `<environment>` should be `development` or `production`, depending on the
|
71
|
+
7. Convert the certificate to a .pem, where `<environment>` should be `development` or `production`, depending on the
|
72
|
+
certificate you exported.
|
80
73
|
|
81
74
|
`openssl pkcs12 -nodes -clcerts -in cert.p12 -out <environment>.pem`
|
82
75
|
|
@@ -86,21 +79,18 @@ You can have each provider per app_name and you can have more than one app_name.
|
|
86
79
|
|
87
80
|
To start the daemon:
|
88
81
|
|
89
|
-
bundle exec
|
82
|
+
bundle exec pushr <options>
|
90
83
|
|
91
|
-
Where `<
|
84
|
+
Where `<options>` can be:
|
92
85
|
|
93
86
|
-f, --foreground Run in the foreground. Log is not written.
|
94
87
|
-p, --pid-file PATH Path to write PID file. Relative to Rails root unless absolute.
|
95
|
-
-P, --push-poll N Frequency in seconds to check for new notifications. Default: 2.
|
96
|
-
-n, --error-notification Enables error notifications via Airbrake or Bugsnag.
|
97
|
-
-F, --feedback-poll N Frequency in seconds to check for feedback for the feedback processor. Default: 60. Use 0 to disable.
|
98
88
|
-b, --feedback-processor PATH Path to the feedback processor. Default: lib/push/feedback_processor.
|
99
89
|
-v, --version Print this version of push.
|
100
90
|
-h, --help You're looking at it.
|
101
91
|
|
102
|
-
|
103
92
|
## Sending notifications
|
93
|
+
|
104
94
|
APNS:
|
105
95
|
```ruby
|
106
96
|
Pushr::MessageApns.create(
|
@@ -112,45 +102,33 @@ Pushr::MessageApns.create(
|
|
112
102
|
expiry: 1.day.to_i,
|
113
103
|
attributes_for_device: {key: 'MSG'})
|
114
104
|
```
|
115
|
-
C2DM:
|
116
|
-
```ruby
|
117
|
-
Pushr::MessageC2dm.create(
|
118
|
-
app: 'app_name',
|
119
|
-
device: '<C2DM registration_id here>',
|
120
|
-
payload: { message: 'Hello World' },
|
121
|
-
collapse_key: 'MSG')
|
122
|
-
```
|
123
105
|
|
124
106
|
GCM:
|
125
107
|
```ruby
|
126
108
|
Pushr::MessageGcm.create(
|
127
109
|
app: 'app_name',
|
128
|
-
|
129
|
-
|
110
|
+
registration_ids: ['<GCM registration_id here>', '<GCM registration_id here>'],
|
111
|
+
notification_key: 'notification_key_name',
|
112
|
+
delay_while_idle: true,
|
113
|
+
data: { message: 'Hello World' },
|
114
|
+
time_to_live: 24 * 60 * 60,
|
115
|
+
restricted_package_name: 'com.example.gcm',
|
116
|
+
dry_run: false,
|
130
117
|
collapse_key: 'MSG')
|
131
118
|
```
|
132
119
|
|
133
120
|
## Feedback processing
|
134
121
|
|
135
|
-
The push providers return feedback in various ways and these are captured and stored in the `push_feedback` table. The
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
The push-core comes with a rake task to delete all the messages and feedback of the last 7 days or by the DAYS parameter.
|
140
|
-
|
141
|
-
bundle exec rake push:clean DAYS=2
|
122
|
+
The push providers return feedback in various ways and these are captured and stored in the `push_feedback` table. The
|
123
|
+
installer installs the `lib/push/feedback_processor.rb` file which is by default called every 60 seconds. In this file
|
124
|
+
you can process the feedback which is different for every application.
|
142
125
|
|
143
126
|
## Heroku
|
144
127
|
|
145
128
|
Push runs on Heroku with the following line in the `Procfile`.
|
146
129
|
|
147
|
-
|
130
|
+
pushr: bundle exec pushr -f
|
148
131
|
|
149
132
|
## Prerequisites
|
150
133
|
|
151
|
-
* Rails 3.2.x
|
152
134
|
* Ruby 1.9.x
|
153
|
-
|
154
|
-
## Thanks
|
155
|
-
|
156
|
-
This project started as a fork of Ian Leitch [RAPNS](https://github.com/ileitch/rapns) project. The differences between this project and RAPNS is the support for C2DM and the modularity of the push providers.
|
data/bin/pushr
CHANGED
@@ -7,37 +7,52 @@ require 'optparse'
|
|
7
7
|
require 'pushr/core'
|
8
8
|
require 'pushr/daemon'
|
9
9
|
|
10
|
-
|
11
|
-
config.foreground = false
|
12
|
-
config.error_notification = false
|
13
|
-
config.feedback_processor = nil
|
14
|
-
config.stats_processor = nil
|
15
|
-
|
10
|
+
settings = Pushr::Daemon::Settings.new
|
16
11
|
banner = 'Usage: pushr [options]'
|
17
12
|
ARGV.options do |opts|
|
18
13
|
opts.banner = banner
|
19
|
-
opts.on('-f', '--foreground', 'Run in the foreground. Log is not written.') { config.foreground = true }
|
20
|
-
opts.on('-p PATH', '--pid-file PATH', String, 'Path to write PID file. Relative to Rails root unless absolute.') { |path| config.pid_file = path }
|
21
|
-
opts.on('-b PATH', '--feedback-processor PATH', String, "Path to the feedback processor. Default: none. Example: 'lib/pushr/feedback_processor'") { |n| config.feedback_processor = n }
|
22
|
-
opts.on('-s PATH', '--stats-processor PATH', String, "Path to the stats processor. Default: none. Example: 'lib/pushr/stats_processor'") { |n| config.stats_processor = n }
|
23
|
-
opts.on('-v', '--version', 'Print this version of pushr.') { puts "pushr #{Pushr::VERSION}"; exit }
|
24
|
-
opts.on('-h', '--help', 'You\'re looking at it.') { puts opts; exit }
|
25
|
-
opts.parse!
|
26
|
-
end
|
27
14
|
|
28
|
-
|
29
|
-
|
15
|
+
opts.on('-f', '--foreground', 'Run in the foreground. Log is not written.') do
|
16
|
+
settings.foreground = true
|
17
|
+
end
|
18
|
+
|
19
|
+
opts.on('-p PATH', '--pid-file PATH', String,
|
20
|
+
'Path to write PID file. Relative to current directory unless absolute.') do |path|
|
21
|
+
settings.pid_file = path
|
22
|
+
end
|
23
|
+
|
24
|
+
opts.on('-b PATH', '--feedback-processor PATH', String,
|
25
|
+
"Path to the feedback processor. Default: none. Example: 'lib/pushr/feedback_processor'") do |n|
|
26
|
+
settings.feedback_processor = n
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on('-s PATH', '--stats-processor PATH', String,
|
30
|
+
"Path to the stats processor. Default: none. Example: 'lib/pushr/stats_processor'") do |n|
|
31
|
+
settings.stats_processor = n
|
32
|
+
end
|
33
|
+
|
34
|
+
opts.on('-v', '--version', 'Print this version of pushr.') do
|
35
|
+
puts "pushr #{Pushr::VERSION}"
|
36
|
+
exit
|
37
|
+
end
|
38
|
+
|
39
|
+
opts.on('-h', '--help', 'You\'re looking at it.') do
|
40
|
+
puts opts
|
41
|
+
exit
|
42
|
+
end
|
43
|
+
|
44
|
+
opts.parse!
|
30
45
|
end
|
31
46
|
|
32
47
|
if ENV['AIRBRAKE_API_KEY']
|
33
48
|
require 'airbrake'
|
34
|
-
|
35
|
-
Airbrake.configure do |
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
49
|
+
settings.error_notification = true
|
50
|
+
Airbrake.configure do |airbrake|
|
51
|
+
airbrake.api_key = ENV['AIRBRAKE_API_KEY']
|
52
|
+
airbrake.host = ENV['AIRBRAKE_HOST']
|
53
|
+
airbrake.port = ENV['AIRBRAKE_PORT'] ? ENV['AIRBRAKE_PORT'].to_i : 80
|
54
|
+
airbrake.secure = airbrake.port == 443
|
40
55
|
end
|
41
56
|
end
|
42
57
|
|
43
|
-
Pushr::Daemon.start(
|
58
|
+
Pushr::Daemon.start(settings)
|
data/lib/pushr/configuration.rb
CHANGED
@@ -5,10 +5,11 @@ module Pushr
|
|
5
5
|
validates :app, presence: true
|
6
6
|
validates :connections, presence: true
|
7
7
|
validates :connections, numericality: { greater_than: 0, only_integer: true }
|
8
|
+
validates :enabled, inclusion: { in: [true, false] }
|
8
9
|
|
9
10
|
def initialize(attributes = {})
|
10
11
|
attributes.each do |name, value|
|
11
|
-
send("#{name}=", value)
|
12
|
+
send("#{name}=", value) if respond_to?("#{name}=")
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
data/lib/pushr/daemon.rb
CHANGED
@@ -2,11 +2,13 @@ require 'thread'
|
|
2
2
|
require 'logger'
|
3
3
|
require 'multi_json'
|
4
4
|
require 'pushr/redis_connection'
|
5
|
+
require 'pushr/daemon/settings'
|
5
6
|
require 'pushr/daemon/delivery_error'
|
6
|
-
require 'pushr/daemon/
|
7
|
+
require 'pushr/daemon/message_handler'
|
7
8
|
require 'pushr/daemon/feedback_handler'
|
8
9
|
require 'pushr/daemon/logger'
|
9
10
|
require 'pushr/daemon/app'
|
11
|
+
require 'pushr/daemon/pid_file'
|
10
12
|
|
11
13
|
module Pushr
|
12
14
|
module Daemon
|
@@ -20,24 +22,25 @@ module Pushr
|
|
20
22
|
setup_signal_hooks
|
21
23
|
|
22
24
|
daemonize unless config.foreground
|
23
|
-
write_pid_file
|
24
25
|
|
25
|
-
|
26
|
+
start_app
|
27
|
+
|
28
|
+
logger.info('[Daemon] Ready')
|
29
|
+
|
30
|
+
sleep 1 until @shutting_down
|
31
|
+
end
|
26
32
|
|
33
|
+
protected
|
34
|
+
|
35
|
+
def self.start_app
|
36
|
+
load_stats_processor
|
27
37
|
App.load
|
28
38
|
scale_redis_connections
|
29
39
|
App.start
|
30
40
|
self.feedback_handler = FeedbackHandler.new(config.feedback_processor)
|
31
41
|
feedback_handler.start
|
32
|
-
|
33
|
-
logger.info('[Daemon] Ready')
|
34
|
-
while !@shutting_down
|
35
|
-
sleep 1
|
36
|
-
end
|
37
42
|
end
|
38
43
|
|
39
|
-
protected
|
40
|
-
|
41
44
|
def self.scale_redis_connections
|
42
45
|
# feedback handler + app + app.totalconnections
|
43
46
|
connections = 1 + 1 + App.total_connections
|
@@ -47,9 +50,7 @@ module Pushr
|
|
47
50
|
end
|
48
51
|
|
49
52
|
def self.load_stats_processor
|
50
|
-
if config.stats_processor
|
51
|
-
require "#{Dir.pwd}/#{config.stats_processor}"
|
52
|
-
end
|
53
|
+
require "#{Dir.pwd}/#{config.stats_processor}" if config.stats_processor
|
53
54
|
rescue => e
|
54
55
|
logger.error("Failed to stats_processor: #{e.inspect}")
|
55
56
|
end
|
@@ -80,13 +81,13 @@ module Pushr
|
|
80
81
|
print '.'
|
81
82
|
end
|
82
83
|
print "\n"
|
83
|
-
|
84
|
+
PidFile.delete(config.pid_file)
|
84
85
|
end
|
85
86
|
|
86
87
|
def self.daemonize
|
87
|
-
exit if
|
88
|
+
exit if fork
|
88
89
|
Process.setsid
|
89
|
-
exit if
|
90
|
+
exit if fork
|
90
91
|
|
91
92
|
Dir.chdir '/'
|
92
93
|
File.umask 0000
|
@@ -94,23 +95,7 @@ module Pushr
|
|
94
95
|
STDIN.reopen '/dev/null'
|
95
96
|
STDOUT.reopen '/dev/null', 'a'
|
96
97
|
STDERR.reopen STDOUT
|
97
|
-
|
98
|
-
|
99
|
-
def self.write_pid_file
|
100
|
-
unless config[:pid_file].blank?
|
101
|
-
begin
|
102
|
-
File.open(config[:pid_file], 'w') do |f|
|
103
|
-
f.puts $PROCESS_ID
|
104
|
-
end
|
105
|
-
rescue SystemCallError => e
|
106
|
-
logger.error("Failed to write PID to '#{config[:pid_file]}': #{e.inspect}")
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def self.delete_pid_file
|
112
|
-
pid_file = config[:pid_file]
|
113
|
-
File.delete(pid_file) if !pid_file.blank? && File.exist?(pid_file)
|
98
|
+
PidFile.write(config.pid_file)
|
114
99
|
end
|
115
100
|
end
|
116
101
|
end
|
data/lib/pushr/daemon/app.rb
CHANGED
@@ -42,7 +42,7 @@ module Pushr
|
|
42
42
|
connection = @provider.connectiontype.new(@config, i + 1)
|
43
43
|
connection.connect
|
44
44
|
|
45
|
-
handler =
|
45
|
+
handler = MessageHandler.new("pushr:#{@config.app}:#{@config.name}", connection, @config.app, i + 1)
|
46
46
|
handler.start
|
47
47
|
@handlers << handler
|
48
48
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module Pushr
|
2
2
|
module Daemon
|
3
|
-
class
|
3
|
+
class MessageHandler
|
4
4
|
attr_reader :name
|
5
5
|
|
6
6
|
def initialize(queue_name, connection, name, i)
|
7
7
|
@queue_name = queue_name
|
8
8
|
@connection = connection
|
9
|
-
@name = "#{name}:
|
9
|
+
@name = "#{name}: MessageHandler #{i}"
|
10
10
|
Pushr::Daemon.logger.info "[#{@name}] listening to #{@queue_name}"
|
11
11
|
end
|
12
12
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Pushr
|
2
|
+
module Daemon
|
3
|
+
class PidFile
|
4
|
+
def self.write(pid_file)
|
5
|
+
unless pid_file.nil?
|
6
|
+
begin
|
7
|
+
File.open(pid_file, 'w') do |f|
|
8
|
+
f.puts Process.pid
|
9
|
+
end
|
10
|
+
rescue SystemCallError => e
|
11
|
+
logger.error("Failed to write PID to '#{pid_file}': #{e.inspect}")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.delete(pid_file)
|
17
|
+
File.delete(pid_file) if !pid_file.blank? && File.exist?(pid_file)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Pushr
|
2
|
+
module Daemon
|
3
|
+
class Settings
|
4
|
+
attr_accessor :foreground, :pid_file, :error_notification, :feedback_processor, :stats_processor
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@foreground = false
|
8
|
+
@error_notification = false
|
9
|
+
@feedback_processor = nil
|
10
|
+
@stats_processor = nil
|
11
|
+
@pid_file = nil
|
12
|
+
end
|
13
|
+
|
14
|
+
def pid_file=(arg)
|
15
|
+
@pid_file = File.join(Dir.pwd, arg) if arg && !Pathname.new(arg).absolute?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/pushr/feedback.rb
CHANGED
data/lib/pushr/message.rb
CHANGED
data/lib/pushr/version.rb
CHANGED
@@ -38,7 +38,7 @@ describe Pushr::Daemon::App do
|
|
38
38
|
|
39
39
|
describe 'class' do
|
40
40
|
it 'should start configuration' do
|
41
|
-
expect_any_instance_of(Pushr::Daemon::
|
41
|
+
expect_any_instance_of(Pushr::Daemon::MessageHandler).to receive(:start)
|
42
42
|
config.save
|
43
43
|
app = Pushr::Daemon::App.new(config)
|
44
44
|
app.start
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'pushr/daemon'
|
3
3
|
|
4
|
-
describe Pushr::Daemon::
|
4
|
+
describe Pushr::Daemon::MessageHandler do
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
Pushr::Core.configure do |config|
|
@@ -22,7 +22,7 @@ describe Pushr::Daemon::DeliveryHandler do
|
|
22
22
|
it 'should start' do
|
23
23
|
message.save
|
24
24
|
connection.connect
|
25
|
-
handler = Pushr::Daemon::
|
25
|
+
handler = Pushr::Daemon::MessageHandler.new('pushr:app_name:dummy', connection, 'app', 1)
|
26
26
|
handler.stop
|
27
27
|
thread = handler.start
|
28
28
|
thread.join
|
@@ -39,7 +39,7 @@ describe Pushr::Daemon::DeliveryHandler do
|
|
39
39
|
expect_any_instance_of(Pushr::Daemon::DummySupport::ConnectionDummy).to receive(:write).and_raise(error)
|
40
40
|
message.save
|
41
41
|
connection.connect
|
42
|
-
handler = Pushr::Daemon::
|
42
|
+
handler = Pushr::Daemon::MessageHandler.new('pushr:app_name:dummy', connection, 'app', 1)
|
43
43
|
handler.stop
|
44
44
|
thread = handler.start
|
45
45
|
thread.join
|
data/spec/spec_helper.rb
CHANGED
@@ -18,9 +18,8 @@ require 'mock_redis'
|
|
18
18
|
Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
|
19
19
|
|
20
20
|
RSpec.configure do |config|
|
21
|
-
config.raise_errors_for_deprecations!
|
22
21
|
config.run_all_when_everything_filtered = true
|
23
|
-
|
22
|
+
config.filter_run :focus
|
24
23
|
|
25
24
|
# Run specs in random order to surface order dependencies. If you find an
|
26
25
|
# order dependency and want to debug it, you can fix the order by providing
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pushr-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.
|
4
|
+
version: 1.0.0.pre.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Pesman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -193,7 +193,7 @@ dependencies:
|
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
description: Pushr daemon for push notification services like APNS (iOS/Apple) and
|
196
|
-
GCM
|
196
|
+
GCM (Android).
|
197
197
|
email:
|
198
198
|
- tom@tnux.net
|
199
199
|
executables:
|
@@ -207,9 +207,11 @@ files:
|
|
207
207
|
- lib/pushr/daemon.rb
|
208
208
|
- lib/pushr/daemon/app.rb
|
209
209
|
- lib/pushr/daemon/delivery_error.rb
|
210
|
-
- lib/pushr/daemon/delivery_handler.rb
|
211
210
|
- lib/pushr/daemon/feedback_handler.rb
|
212
211
|
- lib/pushr/daemon/logger.rb
|
212
|
+
- lib/pushr/daemon/message_handler.rb
|
213
|
+
- lib/pushr/daemon/pid_file.rb
|
214
|
+
- lib/pushr/daemon/settings.rb
|
213
215
|
- lib/pushr/feedback.rb
|
214
216
|
- lib/pushr/message.rb
|
215
217
|
- lib/pushr/redis_connection.rb
|
@@ -219,9 +221,9 @@ files:
|
|
219
221
|
- spec/lib/pushr/configuration_spec.rb
|
220
222
|
- spec/lib/pushr/daemon/app_spec.rb
|
221
223
|
- spec/lib/pushr/daemon/delivery_error_spec.rb
|
222
|
-
- spec/lib/pushr/daemon/delivery_handler_spec.rb
|
223
224
|
- spec/lib/pushr/daemon/feedback_handler_spec.rb
|
224
225
|
- spec/lib/pushr/daemon/logger_spec.rb
|
226
|
+
- spec/lib/pushr/daemon/message_handler_spec.rb
|
225
227
|
- spec/lib/pushr/daemon_spec.rb
|
226
228
|
- spec/lib/pushr/feedback_spec.rb
|
227
229
|
- spec/lib/pushr/message_spec.rb
|
@@ -237,7 +239,8 @@ files:
|
|
237
239
|
- spec/support/pushr_message_dummy.rb
|
238
240
|
- bin/pushr
|
239
241
|
homepage: https://github.com/9to5/pushr-core
|
240
|
-
licenses:
|
242
|
+
licenses:
|
243
|
+
- MIT
|
241
244
|
metadata: {}
|
242
245
|
post_install_message:
|
243
246
|
rdoc_options: []
|
@@ -247,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
247
250
|
requirements:
|
248
251
|
- - ">="
|
249
252
|
- !ruby/object:Gem::Version
|
250
|
-
version:
|
253
|
+
version: 1.9.3
|
251
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
255
|
requirements:
|
253
256
|
- - ">"
|
@@ -263,9 +266,9 @@ test_files:
|
|
263
266
|
- spec/lib/pushr/configuration_spec.rb
|
264
267
|
- spec/lib/pushr/daemon/app_spec.rb
|
265
268
|
- spec/lib/pushr/daemon/delivery_error_spec.rb
|
266
|
-
- spec/lib/pushr/daemon/delivery_handler_spec.rb
|
267
269
|
- spec/lib/pushr/daemon/feedback_handler_spec.rb
|
268
270
|
- spec/lib/pushr/daemon/logger_spec.rb
|
271
|
+
- spec/lib/pushr/daemon/message_handler_spec.rb
|
269
272
|
- spec/lib/pushr/daemon_spec.rb
|
270
273
|
- spec/lib/pushr/feedback_spec.rb
|
271
274
|
- spec/lib/pushr/message_spec.rb
|