rapns 3.3.2 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- 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 +57 -76
- 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,61 +1,51 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapns
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 3
|
8
|
-
- 3
|
9
|
-
- 2
|
10
|
-
version: 3.3.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.4.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Ian Leitch
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: multi_json
|
22
|
-
|
23
|
-
|
24
|
-
none: false
|
25
|
-
requirements:
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
26
17
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 0
|
32
|
-
version: "1.0"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
33
20
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: net-http-persistent
|
37
21
|
prerelease: false
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: net-http-persistent
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
47
34
|
type: :runtime
|
48
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
49
41
|
description: Professional grade APNs and GCM for Ruby
|
50
|
-
email:
|
42
|
+
email:
|
51
43
|
- port001@gmail.com
|
52
|
-
executables:
|
44
|
+
executables:
|
53
45
|
- rapns
|
54
46
|
extensions: []
|
55
|
-
|
56
47
|
extra_rdoc_files: []
|
57
|
-
|
58
|
-
files:
|
48
|
+
files:
|
59
49
|
- CHANGELOG.md
|
60
50
|
- LICENSE
|
61
51
|
- README.md
|
@@ -68,6 +58,7 @@ files:
|
|
68
58
|
- lib/generators/templates/create_rapns_notifications.rb
|
69
59
|
- lib/generators/templates/rapns.rb
|
70
60
|
- lib/rapns.rb
|
61
|
+
- lib/rapns/TODO
|
71
62
|
- lib/rapns/apns/app.rb
|
72
63
|
- lib/rapns/apns/binary_notification_validator.rb
|
73
64
|
- lib/rapns/apns/device_token_format_validator.rb
|
@@ -78,18 +69,18 @@ files:
|
|
78
69
|
- lib/rapns/configuration.rb
|
79
70
|
- lib/rapns/daemon.rb
|
80
71
|
- lib/rapns/daemon/apns/app_runner.rb
|
72
|
+
- lib/rapns/daemon/apns/certificate_expired_error.rb
|
81
73
|
- lib/rapns/daemon/apns/connection.rb
|
82
74
|
- lib/rapns/daemon/apns/delivery.rb
|
83
75
|
- lib/rapns/daemon/apns/delivery_handler.rb
|
84
76
|
- lib/rapns/daemon/apns/disconnection_error.rb
|
85
77
|
- lib/rapns/daemon/apns/feedback_receiver.rb
|
86
78
|
- lib/rapns/daemon/app_runner.rb
|
79
|
+
- lib/rapns/daemon/batch.rb
|
87
80
|
- lib/rapns/daemon/delivery.rb
|
88
81
|
- lib/rapns/daemon/delivery_error.rb
|
89
82
|
- lib/rapns/daemon/delivery_handler.rb
|
90
|
-
- lib/rapns/daemon/
|
91
|
-
- lib/rapns/daemon/delivery_queue_18.rb
|
92
|
-
- lib/rapns/daemon/delivery_queue_19.rb
|
83
|
+
- lib/rapns/daemon/delivery_handler_collection.rb
|
93
84
|
- lib/rapns/daemon/feeder.rb
|
94
85
|
- lib/rapns/daemon/gcm/app_runner.rb
|
95
86
|
- lib/rapns/daemon/gcm/delivery.rb
|
@@ -119,8 +110,6 @@ files:
|
|
119
110
|
- lib/tasks/cane.rake
|
120
111
|
- lib/tasks/test.rake
|
121
112
|
- config/database.yml
|
122
|
-
- spec/acceptance/gcm_upgrade_spec.rb
|
123
|
-
- spec/acceptance_spec_helper.rb
|
124
113
|
- spec/support/cert_with_password.pem
|
125
114
|
- spec/support/cert_without_password.pem
|
126
115
|
- spec/support/simplecov_helper.rb
|
@@ -132,6 +121,7 @@ files:
|
|
132
121
|
- spec/unit/app_spec.rb
|
133
122
|
- spec/unit/configuration_spec.rb
|
134
123
|
- spec/unit/daemon/apns/app_runner_spec.rb
|
124
|
+
- spec/unit/daemon/apns/certificate_expired_error_spec.rb
|
135
125
|
- spec/unit/daemon/apns/connection_spec.rb
|
136
126
|
- spec/unit/daemon/apns/delivery_handler_spec.rb
|
137
127
|
- spec/unit/daemon/apns/delivery_spec.rb
|
@@ -139,9 +129,10 @@ files:
|
|
139
129
|
- spec/unit/daemon/apns/feedback_receiver_spec.rb
|
140
130
|
- spec/unit/daemon/app_runner_shared.rb
|
141
131
|
- spec/unit/daemon/app_runner_spec.rb
|
132
|
+
- spec/unit/daemon/batch_spec.rb
|
142
133
|
- spec/unit/daemon/delivery_error_spec.rb
|
134
|
+
- spec/unit/daemon/delivery_handler_collection_spec.rb
|
143
135
|
- spec/unit/daemon/delivery_handler_shared.rb
|
144
|
-
- spec/unit/daemon/delivery_queue_spec.rb
|
145
136
|
- spec/unit/daemon/feeder_spec.rb
|
146
137
|
- spec/unit/daemon/gcm/app_runner_spec.rb
|
147
138
|
- spec/unit/daemon/gcm/delivery_handler_spec.rb
|
@@ -167,41 +158,29 @@ files:
|
|
167
158
|
- bin/rapns
|
168
159
|
homepage: https://github.com/ileitch/rapns
|
169
160
|
licenses: []
|
170
|
-
|
161
|
+
metadata: {}
|
171
162
|
post_install_message:
|
172
163
|
rdoc_options: []
|
173
|
-
|
174
|
-
require_paths:
|
164
|
+
require_paths:
|
175
165
|
- lib
|
176
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
none: false
|
187
|
-
requirements:
|
188
|
-
- - ">="
|
189
|
-
- !ruby/object:Gem::Version
|
190
|
-
hash: 3
|
191
|
-
segments:
|
192
|
-
- 0
|
193
|
-
version: "0"
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - '>='
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
194
176
|
requirements: []
|
195
|
-
|
196
177
|
rubyforge_project:
|
197
|
-
rubygems_version:
|
178
|
+
rubygems_version: 2.0.3
|
198
179
|
signing_key:
|
199
|
-
specification_version:
|
180
|
+
specification_version: 4
|
200
181
|
summary: Professional grade APNs and GCM for Ruby
|
201
|
-
test_files:
|
182
|
+
test_files:
|
202
183
|
- config/database.yml
|
203
|
-
- spec/acceptance/gcm_upgrade_spec.rb
|
204
|
-
- spec/acceptance_spec_helper.rb
|
205
184
|
- spec/support/cert_with_password.pem
|
206
185
|
- spec/support/cert_without_password.pem
|
207
186
|
- spec/support/simplecov_helper.rb
|
@@ -213,6 +192,7 @@ test_files:
|
|
213
192
|
- spec/unit/app_spec.rb
|
214
193
|
- spec/unit/configuration_spec.rb
|
215
194
|
- spec/unit/daemon/apns/app_runner_spec.rb
|
195
|
+
- spec/unit/daemon/apns/certificate_expired_error_spec.rb
|
216
196
|
- spec/unit/daemon/apns/connection_spec.rb
|
217
197
|
- spec/unit/daemon/apns/delivery_handler_spec.rb
|
218
198
|
- spec/unit/daemon/apns/delivery_spec.rb
|
@@ -220,9 +200,10 @@ test_files:
|
|
220
200
|
- spec/unit/daemon/apns/feedback_receiver_spec.rb
|
221
201
|
- spec/unit/daemon/app_runner_shared.rb
|
222
202
|
- spec/unit/daemon/app_runner_spec.rb
|
203
|
+
- spec/unit/daemon/batch_spec.rb
|
223
204
|
- spec/unit/daemon/delivery_error_spec.rb
|
205
|
+
- spec/unit/daemon/delivery_handler_collection_spec.rb
|
224
206
|
- spec/unit/daemon/delivery_handler_shared.rb
|
225
|
-
- spec/unit/daemon/delivery_queue_spec.rb
|
226
207
|
- spec/unit/daemon/feeder_spec.rb
|
227
208
|
- spec/unit/daemon/gcm/app_runner_spec.rb
|
228
209
|
- 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
|