rapns 3.3.2-java → 3.4.0-java
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.
- data/CHANGELOG.md +7 -0
- data/README.md +19 -21
- data/bin/rapns +14 -13
- data/lib/generators/templates/rapns.rb +8 -4
- data/lib/rapns.rb +7 -0
- data/lib/rapns/TODO +3 -0
- data/lib/rapns/apns/feedback.rb +4 -2
- data/lib/rapns/app.rb +3 -1
- data/lib/rapns/configuration.rb +8 -1
- data/lib/rapns/daemon.rb +3 -1
- data/lib/rapns/daemon/apns/app_runner.rb +3 -2
- data/lib/rapns/daemon/apns/certificate_expired_error.rb +20 -0
- data/lib/rapns/daemon/apns/connection.rb +26 -0
- data/lib/rapns/daemon/apns/delivery.rb +2 -1
- data/lib/rapns/daemon/apns/delivery_handler.rb +2 -2
- data/lib/rapns/daemon/app_runner.rb +50 -28
- data/lib/rapns/daemon/batch.rb +100 -0
- data/lib/rapns/daemon/delivery.rb +6 -10
- data/lib/rapns/daemon/delivery_handler.rb +14 -12
- data/lib/rapns/daemon/delivery_handler_collection.rb +33 -0
- data/lib/rapns/daemon/feeder.rb +3 -5
- data/lib/rapns/daemon/gcm/delivery.rb +5 -4
- data/lib/rapns/daemon/gcm/delivery_handler.rb +2 -2
- data/lib/rapns/daemon/store/active_record.rb +23 -2
- data/lib/rapns/deprecation.rb +7 -6
- data/lib/rapns/logger.rb +1 -1
- data/lib/rapns/notification.rb +5 -3
- data/lib/rapns/reflection.rb +1 -1
- data/lib/rapns/version.rb +1 -1
- data/lib/tasks/cane.rake +1 -1
- data/lib/tasks/test.rake +8 -3
- data/spec/unit/apns/app_spec.rb +4 -4
- data/spec/unit/apns_feedback_spec.rb +1 -1
- data/spec/unit/configuration_spec.rb +12 -6
- data/spec/unit/daemon/apns/app_runner_spec.rb +6 -4
- data/spec/unit/daemon/apns/certificate_expired_error_spec.rb +11 -0
- data/spec/unit/daemon/apns/connection_spec.rb +46 -10
- data/spec/unit/daemon/apns/delivery_handler_spec.rb +24 -18
- data/spec/unit/daemon/apns/delivery_spec.rb +11 -12
- data/spec/unit/daemon/apns/feedback_receiver_spec.rb +16 -16
- data/spec/unit/daemon/app_runner_shared.rb +27 -10
- data/spec/unit/daemon/app_runner_spec.rb +48 -28
- data/spec/unit/daemon/batch_spec.rb +160 -0
- data/spec/unit/daemon/delivery_handler_collection_spec.rb +37 -0
- data/spec/unit/daemon/delivery_handler_shared.rb +20 -11
- data/spec/unit/daemon/feeder_spec.rb +12 -12
- data/spec/unit/daemon/gcm/app_runner_spec.rb +4 -2
- data/spec/unit/daemon/gcm/delivery_handler_spec.rb +18 -10
- data/spec/unit/daemon/gcm/delivery_spec.rb +47 -17
- data/spec/unit/daemon/interruptible_sleep_spec.rb +3 -3
- data/spec/unit/daemon/reflectable_spec.rb +1 -1
- data/spec/unit/daemon/store/active_record/reconnectable_spec.rb +1 -1
- data/spec/unit/daemon/store/active_record_spec.rb +87 -10
- data/spec/unit/daemon_spec.rb +6 -6
- data/spec/unit/deprecation_spec.rb +2 -2
- data/spec/unit/logger_spec.rb +33 -17
- data/spec/unit/notification_shared.rb +7 -3
- data/spec/unit/upgraded_spec.rb +8 -14
- data/spec/unit_spec_helper.rb +9 -1
- metadata +53 -44
- data/lib/rapns/daemon/delivery_queue.rb +0 -42
- data/lib/rapns/daemon/delivery_queue_18.rb +0 -44
- data/lib/rapns/daemon/delivery_queue_19.rb +0 -42
- data/spec/acceptance/gcm_upgrade_spec.rb +0 -34
- data/spec/acceptance_spec_helper.rb +0 -85
- data/spec/unit/daemon/delivery_queue_spec.rb +0 -29
@@ -6,9 +6,9 @@ describe Rapns::Deprecation do
|
|
6
6
|
Rapns::Deprecation.warn("msg")
|
7
7
|
end
|
8
8
|
|
9
|
-
it 'does not print a warning when
|
9
|
+
it 'does not print a warning when muted' do
|
10
10
|
STDERR.should_not_receive(:puts)
|
11
|
-
Rapns::Deprecation.
|
11
|
+
Rapns::Deprecation.muted do
|
12
12
|
Rapns::Deprecation.warn("msg")
|
13
13
|
end
|
14
14
|
end
|
data/spec/unit/logger_spec.rb
CHANGED
@@ -21,14 +21,21 @@ module Airbrake
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe Rapns::Logger do
|
24
|
-
let(:log) {
|
25
|
-
let(:config) {
|
24
|
+
let(:log) { double(:sync= => true) }
|
25
|
+
let(:config) { double(:airbrake_notify => true) }
|
26
26
|
|
27
27
|
before do
|
28
28
|
Rails.stub(:root).and_return("/rails_root")
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
|
30
|
+
@logger_class = if defined?(ActiveSupport::BufferedLogger)
|
31
|
+
ActiveSupport::BufferedLogger
|
32
|
+
else
|
33
|
+
ActiveSupport::Logger
|
34
|
+
end
|
35
|
+
|
36
|
+
@logger = double(@logger_class.name, :info => nil, :error => nil, :level => 0, :auto_flushing => 1, :auto_flushing= => nil)
|
37
|
+
@logger_class.stub(:new).and_return(@logger)
|
38
|
+
Rails.logger = @logger
|
32
39
|
File.stub(:open => log)
|
33
40
|
STDERR.stub(:puts)
|
34
41
|
end
|
@@ -50,19 +57,28 @@ describe Rapns::Logger do
|
|
50
57
|
Rapns::Logger.new(:foreground => true)
|
51
58
|
end
|
52
59
|
|
53
|
-
it 'instantiates the BufferedLogger' do
|
54
|
-
ActiveSupport::BufferedLogger.should_receive(:new).with(log, Rails.logger.level)
|
55
|
-
Rapns::Logger.new(:foreground => true)
|
56
|
-
end
|
57
|
-
|
58
60
|
it 'uses the user-defined logger' do
|
59
|
-
my_logger =
|
61
|
+
my_logger = double
|
60
62
|
Rapns.config.logger = my_logger
|
61
63
|
logger = Rapns::Logger.new({})
|
62
64
|
my_logger.should_receive(:info)
|
63
65
|
logger.info('test')
|
64
66
|
end
|
65
67
|
|
68
|
+
it 'uses ActiveSupport::BufferedLogger if a user-defined logger is not set' do
|
69
|
+
if ActiveSupport.const_defined?('BufferedLogger')
|
70
|
+
ActiveSupport::BufferedLogger.should_receive(:new).with(log, Rails.logger.level)
|
71
|
+
Rapns::Logger.new(:foreground => true)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'uses ActiveSupport::Logger if BufferedLogger does not exist' do
|
76
|
+
stub_const('ActiveSupport::Logger', double)
|
77
|
+
ActiveSupport.stub(:const_defined? => false)
|
78
|
+
ActiveSupport::Logger.should_receive(:new).with(log, Rails.logger.level)
|
79
|
+
Rapns::Logger.new(:foreground => true)
|
80
|
+
end
|
81
|
+
|
66
82
|
it "should print out the msg if running in the foreground" do
|
67
83
|
logger = Rapns::Logger.new(:foreground => true)
|
68
84
|
STDOUT.should_receive(:puts).with(/hi mom/)
|
@@ -79,19 +95,19 @@ describe Rapns::Logger do
|
|
79
95
|
now = Time.now
|
80
96
|
Time.stub(:now).and_return(now)
|
81
97
|
logger = Rapns::Logger.new(:foreground => false)
|
82
|
-
@
|
98
|
+
@logger.should_receive(:info).with(/#{Regexp.escape("[#{now.to_s(:db)}]")}/)
|
83
99
|
logger.info("blah")
|
84
100
|
end
|
85
101
|
|
86
102
|
it "should prefix error logs with the ERROR label" do
|
87
103
|
logger = Rapns::Logger.new(:foreground => false)
|
88
|
-
@
|
104
|
+
@logger.should_receive(:error).with(/#{Regexp.escape("[ERROR]")}/)
|
89
105
|
logger.error("eeek")
|
90
106
|
end
|
91
107
|
|
92
108
|
it "should prefix warn logs with the WARNING label" do
|
93
109
|
logger = Rapns::Logger.new(:foreground => false)
|
94
|
-
@
|
110
|
+
@logger.should_receive(:warn).with(/#{Regexp.escape("[WARNING]")}/)
|
95
111
|
logger.warn("eeek")
|
96
112
|
end
|
97
113
|
|
@@ -99,7 +115,7 @@ describe Rapns::Logger do
|
|
99
115
|
e = RuntimeError.new("hi mom")
|
100
116
|
e.stub(:backtrace => [])
|
101
117
|
logger = Rapns::Logger.new(:foreground => false)
|
102
|
-
@
|
118
|
+
@logger.should_receive(:error).with(/RuntimeError, hi mom/)
|
103
119
|
logger.error(e)
|
104
120
|
end
|
105
121
|
|
@@ -155,9 +171,9 @@ describe Rapns::Logger do
|
|
155
171
|
end
|
156
172
|
|
157
173
|
it 'defaults auto_flushing to true if the Rails logger does not respond to auto_flushing' do
|
158
|
-
rails_logger =
|
174
|
+
rails_logger = double(:info => nil, :error => nil, :level => 0)
|
159
175
|
Rails.logger = rails_logger
|
160
176
|
logger = Rapns::Logger.new({})
|
161
|
-
@
|
177
|
+
@logger.auto_flushing.should be_true
|
162
178
|
end
|
163
179
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
shared_examples_for "an Notification subclass" do
|
2
2
|
describe "when assigning data for the device" do
|
3
|
+
before { Rapns::Deprecation.stub(:warn) }
|
4
|
+
|
3
5
|
it "calls MultiJson.dump when multi_json responds to :dump" do
|
4
6
|
notification = notification_class.new
|
5
7
|
MultiJson.stub(:respond_to?).with(:dump).and_return(true)
|
@@ -30,9 +32,11 @@ shared_examples_for "an Notification subclass" do
|
|
30
32
|
notification.send(data_getter).should == {"hi" => "mom"}
|
31
33
|
end
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
if Rails::VERSION::STRING < '4'
|
36
|
+
it 'warns if attributes_for_device is assigned via mass-assignment' do
|
37
|
+
Rapns::Deprecation.should_receive(:warn).with(':attributes_for_device via mass-assignment is deprecated. Use :data or the attributes_for_device= instance method.')
|
38
|
+
notification_class.new(:attributes_for_device => {:hi => 'mom'})
|
39
|
+
end
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
data/spec/unit/upgraded_spec.rb
CHANGED
@@ -1,39 +1,33 @@
|
|
1
1
|
require 'unit_spec_helper'
|
2
2
|
|
3
3
|
describe Rapns::Upgraded do
|
4
|
-
let(:logger) {
|
5
|
-
let(:config) {
|
4
|
+
let(:logger) { double(:logger, :warn => nil) }
|
5
|
+
let(:config) { double(:config) }
|
6
6
|
|
7
7
|
before do
|
8
8
|
Rails.stub(:root).and_return('/rails_root')
|
9
9
|
Rapns.stub(:logger => logger, :config => config)
|
10
10
|
end
|
11
11
|
|
12
|
-
it 'prints a warning if there are no apps' do
|
13
|
-
Rapns::App.stub(:count => 0)
|
14
|
-
Rapns.logger.should_receive(:warn).any_number_of_times
|
15
|
-
Rapns::Upgraded.check(:exit => false)
|
16
|
-
end
|
17
|
-
|
18
12
|
it 'prints a warning and exists if rapns has not been upgraded' do
|
19
|
-
Rapns::App.stub(:count).and_raise(ActiveRecord::StatementInvalid)
|
20
|
-
Rapns::Upgraded.
|
13
|
+
Rapns::App.stub(:count).and_raise(ActiveRecord::StatementInvalid, "test")
|
14
|
+
Rapns::Upgraded.stub(:puts)
|
21
15
|
Rapns::Upgraded.should_receive(:exit).with(1)
|
22
16
|
Rapns::Upgraded.check(:exit => true)
|
23
17
|
end
|
24
18
|
|
25
19
|
it 'does not exit if Rapns has not been upgraded and :exit is false' do
|
26
20
|
Rapns.config.stub(:embedded => true)
|
27
|
-
Rapns::App.stub(:count).and_raise(ActiveRecord::StatementInvalid)
|
28
|
-
Rapns::Upgraded.
|
21
|
+
Rapns::App.stub(:count).and_raise(ActiveRecord::StatementInvalid, "test")
|
22
|
+
Rapns::Upgraded.stub(:puts)
|
29
23
|
Rapns::Upgraded.should_not_receive(:exit)
|
30
24
|
Rapns::Upgraded.check(:exit => false)
|
31
25
|
end
|
32
26
|
|
33
27
|
it 'does not exit if Rapns has not been upgraded and is in push mode' do
|
34
28
|
Rapns.config.stub(:push => true)
|
35
|
-
Rapns::App.stub(:count).and_raise(ActiveRecord::StatementInvalid)
|
36
|
-
Rapns::Upgraded.
|
29
|
+
Rapns::App.stub(:count).and_raise(ActiveRecord::StatementInvalid, "test")
|
30
|
+
Rapns::Upgraded.stub(:puts)
|
37
31
|
Rapns::Upgraded.should_not_receive(:exit)
|
38
32
|
Rapns::Upgraded.check(:exit => false)
|
39
33
|
end
|
data/spec/unit_spec_helper.rb
CHANGED
@@ -9,6 +9,7 @@ rescue LoadError
|
|
9
9
|
end
|
10
10
|
|
11
11
|
require 'active_record'
|
12
|
+
# require 'timecop'
|
12
13
|
|
13
14
|
jruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
14
15
|
|
@@ -52,6 +53,11 @@ Bundler.require(:default)
|
|
52
53
|
|
53
54
|
require 'database_cleaner'
|
54
55
|
|
56
|
+
# Ensure SQLite3Adapter is loaded before DatabaseCleaner so that DC
|
57
|
+
# can detect the correct superclass.
|
58
|
+
# SQLite3 is used by the acceptance tests.
|
59
|
+
require 'active_record/connection_adapters/sqlite3_adapter'
|
60
|
+
|
55
61
|
DatabaseCleaner.strategy = :truncation
|
56
62
|
|
57
63
|
require 'rapns'
|
@@ -76,7 +82,9 @@ RSpec.configure do |config|
|
|
76
82
|
config.after(:each) do
|
77
83
|
Rapns.logger = nil
|
78
84
|
Rapns::Daemon.store = nil
|
79
|
-
Rapns.
|
85
|
+
Rapns::Deprecation.muted do
|
86
|
+
Rapns.config.set_defaults if Rapns.config.kind_of?(Rapns::Configuration)
|
87
|
+
end
|
80
88
|
end
|
81
89
|
end
|
82
90
|
|
metadata
CHANGED
@@ -1,80 +1,86 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.2
|
5
4
|
prerelease:
|
5
|
+
version: 3.4.0
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Ian Leitch
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
+
prerelease: false
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.0'
|
21
|
+
none: false
|
22
|
+
type: :runtime
|
15
23
|
name: multi_json
|
16
24
|
version_requirements: !ruby/object:Gem::Requirement
|
17
25
|
requirements:
|
18
|
-
- - ~>
|
26
|
+
- - "~>"
|
19
27
|
- !ruby/object:Gem::Version
|
20
28
|
version: '1.0'
|
21
29
|
none: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
prerelease: false
|
22
32
|
requirement: !ruby/object:Gem::Requirement
|
23
33
|
requirements:
|
24
|
-
- -
|
34
|
+
- - ">="
|
25
35
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
36
|
+
version: !binary |-
|
37
|
+
MA==
|
27
38
|
none: false
|
28
|
-
prerelease: false
|
29
39
|
type: :runtime
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
40
|
name: net-http-persistent
|
32
41
|
version_requirements: !ruby/object:Gem::Requirement
|
33
42
|
requirements:
|
34
|
-
- -
|
43
|
+
- - ">="
|
35
44
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
45
|
+
version: !binary |-
|
46
|
+
MA==
|
37
47
|
none: false
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
prerelease: false
|
38
50
|
requirement: !ruby/object:Gem::Requirement
|
39
51
|
requirements:
|
40
|
-
- -
|
52
|
+
- - ">="
|
41
53
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
54
|
+
version: !binary |-
|
55
|
+
MA==
|
43
56
|
none: false
|
44
|
-
prerelease: false
|
45
57
|
type: :runtime
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
58
|
name: jruby-openssl
|
48
59
|
version_requirements: !ruby/object:Gem::Requirement
|
49
60
|
requirements:
|
50
|
-
- -
|
61
|
+
- - ">="
|
51
62
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
63
|
+
version: !binary |-
|
64
|
+
MA==
|
53
65
|
none: false
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
prerelease: false
|
54
68
|
requirement: !ruby/object:Gem::Requirement
|
55
69
|
requirements:
|
56
|
-
- -
|
70
|
+
- - ">="
|
57
71
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
72
|
+
version: !binary |-
|
73
|
+
MA==
|
59
74
|
none: false
|
60
|
-
prerelease: false
|
61
75
|
type: :runtime
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
76
|
name: activerecord-jdbc-adapter
|
64
77
|
version_requirements: !ruby/object:Gem::Requirement
|
65
78
|
requirements:
|
66
|
-
- -
|
79
|
+
- - ">="
|
67
80
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
81
|
+
version: !binary |-
|
82
|
+
MA==
|
69
83
|
none: false
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - '>='
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '0'
|
75
|
-
none: false
|
76
|
-
prerelease: false
|
77
|
-
type: :runtime
|
78
84
|
description: Professional grade APNs and GCM for Ruby
|
79
85
|
email:
|
80
86
|
- port001@gmail.com
|
@@ -95,6 +101,7 @@ files:
|
|
95
101
|
- lib/generators/templates/create_rapns_notifications.rb
|
96
102
|
- lib/generators/templates/rapns.rb
|
97
103
|
- lib/rapns.rb
|
104
|
+
- lib/rapns/TODO
|
98
105
|
- lib/rapns/apns/app.rb
|
99
106
|
- lib/rapns/apns/binary_notification_validator.rb
|
100
107
|
- lib/rapns/apns/device_token_format_validator.rb
|
@@ -105,18 +112,18 @@ files:
|
|
105
112
|
- lib/rapns/configuration.rb
|
106
113
|
- lib/rapns/daemon.rb
|
107
114
|
- lib/rapns/daemon/apns/app_runner.rb
|
115
|
+
- lib/rapns/daemon/apns/certificate_expired_error.rb
|
108
116
|
- lib/rapns/daemon/apns/connection.rb
|
109
117
|
- lib/rapns/daemon/apns/delivery.rb
|
110
118
|
- lib/rapns/daemon/apns/delivery_handler.rb
|
111
119
|
- lib/rapns/daemon/apns/disconnection_error.rb
|
112
120
|
- lib/rapns/daemon/apns/feedback_receiver.rb
|
113
121
|
- lib/rapns/daemon/app_runner.rb
|
122
|
+
- lib/rapns/daemon/batch.rb
|
114
123
|
- lib/rapns/daemon/delivery.rb
|
115
124
|
- lib/rapns/daemon/delivery_error.rb
|
116
125
|
- lib/rapns/daemon/delivery_handler.rb
|
117
|
-
- lib/rapns/daemon/
|
118
|
-
- lib/rapns/daemon/delivery_queue_18.rb
|
119
|
-
- lib/rapns/daemon/delivery_queue_19.rb
|
126
|
+
- lib/rapns/daemon/delivery_handler_collection.rb
|
120
127
|
- lib/rapns/daemon/feeder.rb
|
121
128
|
- lib/rapns/daemon/gcm/app_runner.rb
|
122
129
|
- lib/rapns/daemon/gcm/delivery.rb
|
@@ -146,8 +153,6 @@ files:
|
|
146
153
|
- lib/tasks/cane.rake
|
147
154
|
- lib/tasks/test.rake
|
148
155
|
- config/database.yml
|
149
|
-
- spec/acceptance/gcm_upgrade_spec.rb
|
150
|
-
- spec/acceptance_spec_helper.rb
|
151
156
|
- spec/support/cert_with_password.pem
|
152
157
|
- spec/support/cert_without_password.pem
|
153
158
|
- spec/support/simplecov_helper.rb
|
@@ -159,6 +164,7 @@ files:
|
|
159
164
|
- spec/unit/app_spec.rb
|
160
165
|
- spec/unit/configuration_spec.rb
|
161
166
|
- spec/unit/daemon/apns/app_runner_spec.rb
|
167
|
+
- spec/unit/daemon/apns/certificate_expired_error_spec.rb
|
162
168
|
- spec/unit/daemon/apns/connection_spec.rb
|
163
169
|
- spec/unit/daemon/apns/delivery_handler_spec.rb
|
164
170
|
- spec/unit/daemon/apns/delivery_spec.rb
|
@@ -166,9 +172,10 @@ files:
|
|
166
172
|
- spec/unit/daemon/apns/feedback_receiver_spec.rb
|
167
173
|
- spec/unit/daemon/app_runner_shared.rb
|
168
174
|
- spec/unit/daemon/app_runner_spec.rb
|
175
|
+
- spec/unit/daemon/batch_spec.rb
|
169
176
|
- spec/unit/daemon/delivery_error_spec.rb
|
177
|
+
- spec/unit/daemon/delivery_handler_collection_spec.rb
|
170
178
|
- spec/unit/daemon/delivery_handler_shared.rb
|
171
|
-
- spec/unit/daemon/delivery_queue_spec.rb
|
172
179
|
- spec/unit/daemon/feeder_spec.rb
|
173
180
|
- spec/unit/daemon/gcm/app_runner_spec.rb
|
174
181
|
- spec/unit/daemon/gcm/delivery_handler_spec.rb
|
@@ -200,21 +207,23 @@ require_paths:
|
|
200
207
|
- lib
|
201
208
|
required_ruby_version: !ruby/object:Gem::Requirement
|
202
209
|
requirements:
|
203
|
-
- -
|
210
|
+
- - ">="
|
204
211
|
- !ruby/object:Gem::Version
|
212
|
+
version: !binary |-
|
213
|
+
MA==
|
214
|
+
hash: 2
|
205
215
|
segments:
|
206
216
|
- 0
|
207
|
-
version: '0'
|
208
|
-
hash: 2
|
209
217
|
none: false
|
210
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
219
|
requirements:
|
212
|
-
- -
|
220
|
+
- - ">="
|
213
221
|
- !ruby/object:Gem::Version
|
222
|
+
version: !binary |-
|
223
|
+
MA==
|
224
|
+
hash: 2
|
214
225
|
segments:
|
215
226
|
- 0
|
216
|
-
version: '0'
|
217
|
-
hash: 2
|
218
227
|
none: false
|
219
228
|
requirements: []
|
220
229
|
rubyforge_project:
|
@@ -224,8 +233,6 @@ specification_version: 3
|
|
224
233
|
summary: Professional grade APNs and GCM for Ruby
|
225
234
|
test_files:
|
226
235
|
- config/database.yml
|
227
|
-
- spec/acceptance/gcm_upgrade_spec.rb
|
228
|
-
- spec/acceptance_spec_helper.rb
|
229
236
|
- spec/support/cert_with_password.pem
|
230
237
|
- spec/support/cert_without_password.pem
|
231
238
|
- spec/support/simplecov_helper.rb
|
@@ -237,6 +244,7 @@ test_files:
|
|
237
244
|
- spec/unit/app_spec.rb
|
238
245
|
- spec/unit/configuration_spec.rb
|
239
246
|
- spec/unit/daemon/apns/app_runner_spec.rb
|
247
|
+
- spec/unit/daemon/apns/certificate_expired_error_spec.rb
|
240
248
|
- spec/unit/daemon/apns/connection_spec.rb
|
241
249
|
- spec/unit/daemon/apns/delivery_handler_spec.rb
|
242
250
|
- spec/unit/daemon/apns/delivery_spec.rb
|
@@ -244,9 +252,10 @@ test_files:
|
|
244
252
|
- spec/unit/daemon/apns/feedback_receiver_spec.rb
|
245
253
|
- spec/unit/daemon/app_runner_shared.rb
|
246
254
|
- spec/unit/daemon/app_runner_spec.rb
|
255
|
+
- spec/unit/daemon/batch_spec.rb
|
247
256
|
- spec/unit/daemon/delivery_error_spec.rb
|
257
|
+
- spec/unit/daemon/delivery_handler_collection_spec.rb
|
248
258
|
- spec/unit/daemon/delivery_handler_shared.rb
|
249
|
-
- spec/unit/daemon/delivery_queue_spec.rb
|
250
259
|
- spec/unit/daemon/feeder_spec.rb
|
251
260
|
- spec/unit/daemon/gcm/app_runner_spec.rb
|
252
261
|
- spec/unit/daemon/gcm/delivery_handler_spec.rb
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module Rapns
|
2
|
-
module Daemon
|
3
|
-
if RUBY_VERSION < '1.9'
|
4
|
-
require 'rapns/daemon/delivery_queue_18'
|
5
|
-
ancestor_class = DeliveryQueue18
|
6
|
-
else
|
7
|
-
require 'rapns/daemon/delivery_queue_19'
|
8
|
-
ancestor_class = DeliveryQueue19
|
9
|
-
end
|
10
|
-
|
11
|
-
class DeliveryQueue < ancestor_class
|
12
|
-
class WakeupError < StandardError; end
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
@num_notifications = 0
|
16
|
-
@queue = []
|
17
|
-
@waiting = []
|
18
|
-
|
19
|
-
super
|
20
|
-
end
|
21
|
-
|
22
|
-
def wakeup(thread)
|
23
|
-
synchronize do
|
24
|
-
t = @waiting.delete(thread)
|
25
|
-
t.raise WakeupError if t
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def size
|
30
|
-
synchronize { @queue.size }
|
31
|
-
end
|
32
|
-
|
33
|
-
def notification_processed
|
34
|
-
synchronize { @num_notifications -= 1 }
|
35
|
-
end
|
36
|
-
|
37
|
-
def notifications_processed?
|
38
|
-
synchronize { @num_notifications <= 0 }
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|