rapns 3.0.0-java → 3.0.1-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 +13 -11
- data/lib/rapns.rb +2 -0
- data/lib/rapns/deprecatable.rb +23 -0
- data/lib/rapns/deprecation.rb +22 -0
- data/lib/rapns/notification.rb +3 -2
- data/lib/rapns/version.rb +1 -1
- data/spec/unit/deprecatable_spec.rb +32 -0
- data/spec/unit/deprecation_spec.rb +15 -0
- data/spec/unit/notification_shared.rb +1 -1
- metadata +8 -2
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 3.0.1 (Sun 16, 2012)
|
2
|
+
* Fix compatibility with Rails 3.0.x. Fixes #89.
|
3
|
+
|
4
|
+
## 3.0.0 (Sat 15, 2012)
|
5
|
+
* Add support for Google Cloud Messaging.
|
6
|
+
* Fix Heroku logging issue.
|
7
|
+
|
1
8
|
## 2.0.5 (Nov 4, 2012) ##
|
2
9
|
* Support content-available (#68).
|
3
10
|
* Append to log files.
|
data/README.md
CHANGED
@@ -10,6 +10,8 @@
|
|
10
10
|
* Works with MRI, JRuby, Rubinius 1.8 and 1.9.
|
11
11
|
* [Airbrake](http://airbrakeapp.com/) integration.
|
12
12
|
|
13
|
+
#### 2.x users please read [upgrading from 2.x to 3.0](rapns/wiki/Upgrading-from-version-2.x-to-3.0)
|
14
|
+
|
13
15
|
### Who uses Rapns?
|
14
16
|
|
15
17
|
[GateGuru](http://gateguruapp.com) and [Desk.com](http://desk.com), among others!
|
@@ -22,12 +24,12 @@ Add Rapns to your Gemfile:
|
|
22
24
|
|
23
25
|
gem 'rapns'
|
24
26
|
|
25
|
-
Generate the
|
27
|
+
Generate the migrations, rapns.yml and migrate:
|
26
28
|
|
27
29
|
rails g rapns
|
28
30
|
rake db:migrate
|
29
31
|
|
30
|
-
## Generating Certificates
|
32
|
+
## Generating Certificates (APNs only)
|
31
33
|
|
32
34
|
1. Open up Keychain Access and select the `Certificates` category in the sidebar.
|
33
35
|
2. Expand the disclosure arrow next to the iOS Push Services certificate you want to export.
|
@@ -87,7 +89,7 @@ n.save!
|
|
87
89
|
cd /path/to/rails/app
|
88
90
|
rapns <Rails environment> [options]
|
89
91
|
|
90
|
-
See [Configuration](wiki/Configuration) for a list of options, or run `rapns --help`.
|
92
|
+
See [Configuration](rapns/wiki/Configuration) for a list of options, or run `rapns --help`.
|
91
93
|
|
92
94
|
## Updating Rapns
|
93
95
|
|
@@ -96,16 +98,16 @@ After updating you should run `rails g rapns` to check for any new migrations.
|
|
96
98
|
## Wiki
|
97
99
|
|
98
100
|
### General
|
99
|
-
* [Configuration](wiki/Configuration)
|
100
|
-
* [Upgrading from 2.x to 3.0](wiki/Upgrading-from-version-2.x-to-3.0)
|
101
|
-
* [Deploying to Heroku](wiki/Heroku)
|
102
|
-
* [Hot App Updates](wiki/Hot-App-Updates)
|
101
|
+
* [Configuration](rapns/wiki/Configuration)
|
102
|
+
* [Upgrading from 2.x to 3.0](rapns/wiki/Upgrading-from-version-2.x-to-3.0)
|
103
|
+
* [Deploying to Heroku](rapns/wiki/Heroku)
|
104
|
+
* [Hot App Updates](rapns/wiki/Hot-App-Updates)
|
103
105
|
|
104
106
|
### APNs
|
105
|
-
* [Advanced APNs Features](wiki/Advanced-APNs-Features)
|
106
|
-
* [APNs Delivery Failure Handling](wiki/APNs-Delivery-Failure-Handling)
|
107
|
-
* [Why open multiple connections to the APNs?](wiki/Why-open-multiple-connections-to-the-APNs%3F)
|
108
|
-
* [Silent failures might be dropped connections](wiki/Dropped-connections)
|
107
|
+
* [Advanced APNs Features](rapns/wiki/Advanced-APNs-Features)
|
108
|
+
* [APNs Delivery Failure Handling](rapns/wiki/APNs-Delivery-Failure-Handling)
|
109
|
+
* [Why open multiple connections to the APNs?](rapns/wiki/Why-open-multiple-connections-to-the-APNs%3F)
|
110
|
+
* [Silent failures might be dropped connections](rapns/wiki/Dropped-connections)
|
109
111
|
|
110
112
|
### GCM
|
111
113
|
|
data/lib/rapns.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Rapns
|
2
|
+
module Deprecatable
|
3
|
+
def self.included(base)
|
4
|
+
base.extend ClassMethods
|
5
|
+
end
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
def deprecated(method_name, version, msg=nil)
|
9
|
+
instance_eval do
|
10
|
+
alias_method "#{method_name}_without_warning", method_name
|
11
|
+
end
|
12
|
+
warning = "#{method_name} is deprecated and will be removed from Rapns #{version}."
|
13
|
+
warning << " #{msg}" if msg
|
14
|
+
class_eval(<<-RUBY, __FILE__, __LINE__)
|
15
|
+
def #{method_name}(*args, &blk)
|
16
|
+
Rapns::Deprecation.warn(#{warning.inspect})
|
17
|
+
#{method_name}_without_warning(*args, &blk)
|
18
|
+
end
|
19
|
+
RUBY
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Rapns
|
2
|
+
class Deprecation
|
3
|
+
def self.silenced
|
4
|
+
begin
|
5
|
+
Thread.current[:rapns_silence_deprecations] = true
|
6
|
+
yield
|
7
|
+
ensure
|
8
|
+
Thread.current[:rapns_silence_deprecations] = false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.silenced?
|
13
|
+
Thread.current[:rapns_silence_deprecations]
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.warn(msg)
|
17
|
+
unless Rapns::Deprecation.silenced?
|
18
|
+
STDERR.puts "DEPRECATION WARNING: #{msg}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/rapns/notification.rb
CHANGED
@@ -25,10 +25,11 @@ module Rapns
|
|
25
25
|
where(:app_id => apps.map(&:id))
|
26
26
|
}
|
27
27
|
|
28
|
-
def initialize(
|
28
|
+
def initialize(*args)
|
29
|
+
attributes = args.first
|
29
30
|
if attributes.is_a?(Hash) && attributes.keys.include?(:attributes_for_device)
|
30
31
|
msg = ":attributes_for_device via mass-assignment is deprecated. Use :data or the attributes_for_device= instance method."
|
31
|
-
|
32
|
+
Rapns::Deprecation.warn(msg)
|
32
33
|
end
|
33
34
|
super
|
34
35
|
end
|
data/lib/rapns/version.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'unit_spec_helper'
|
2
|
+
|
3
|
+
describe Rapns::Deprecatable do
|
4
|
+
class HasDeprecatedMethod
|
5
|
+
include Rapns::Deprecatable
|
6
|
+
|
7
|
+
def original_called?
|
8
|
+
@called == true
|
9
|
+
end
|
10
|
+
|
11
|
+
def deprecated_method
|
12
|
+
@called = true
|
13
|
+
end
|
14
|
+
deprecated(:deprecated_method, '4.0')
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:klass) { HasDeprecatedMethod.new }
|
18
|
+
|
19
|
+
before do
|
20
|
+
Rapns::Deprecation.stub(:warn)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'warns the method is deprecated when called' do
|
24
|
+
Rapns::Deprecation.should_receive(:warn).with("deprecated_method is deprecated and will be removed from Rapns 4.0.")
|
25
|
+
klass.deprecated_method
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'calls the original method' do
|
29
|
+
klass.deprecated_method
|
30
|
+
klass.original_called?.should be_true
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'unit_spec_helper'
|
2
|
+
|
3
|
+
describe Rapns::Deprecation do
|
4
|
+
it 'prints a warning' do
|
5
|
+
STDERR.should_receive(:puts).with("DEPRECATION WARNING: msg")
|
6
|
+
Rapns::Deprecation.warn("msg")
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'does not print a warning when silenced' do
|
10
|
+
STDERR.should_not_receive(:puts)
|
11
|
+
Rapns::Deprecation.silenced do
|
12
|
+
Rapns::Deprecation.warn("msg")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -31,7 +31,7 @@ shared_examples_for "an Notification subclass" do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'warns if attributes_for_device is assigned via mass-assignment' do
|
34
|
-
|
34
|
+
Rapns::Deprecation.should_receive(:warn)
|
35
35
|
notification_class.new(:attributes_for_device => {:hi => 'mom'})
|
36
36
|
end
|
37
37
|
end
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: rapns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 3.0.
|
5
|
+
version: 3.0.1
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Ian Leitch
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -130,6 +130,8 @@ files:
|
|
130
130
|
- lib/rapns/daemon/gcm/delivery_handler.rb
|
131
131
|
- lib/rapns/daemon/interruptible_sleep.rb
|
132
132
|
- lib/rapns/daemon/logger.rb
|
133
|
+
- lib/rapns/deprecatable.rb
|
134
|
+
- lib/rapns/deprecation.rb
|
133
135
|
- lib/rapns/gcm/app.rb
|
134
136
|
- lib/rapns/gcm/expiry_collapse_key_mutual_inclusion_validator.rb
|
135
137
|
- lib/rapns/gcm/notification.rb
|
@@ -171,6 +173,8 @@ files:
|
|
171
173
|
- spec/unit/daemon/interruptible_sleep_spec.rb
|
172
174
|
- spec/unit/daemon/logger_spec.rb
|
173
175
|
- spec/unit/daemon_spec.rb
|
176
|
+
- spec/unit/deprecatable_spec.rb
|
177
|
+
- spec/unit/deprecation_spec.rb
|
174
178
|
- spec/unit/gcm/app_spec.rb
|
175
179
|
- spec/unit/gcm/notification_spec.rb
|
176
180
|
- spec/unit/notification_shared.rb
|
@@ -233,6 +237,8 @@ test_files:
|
|
233
237
|
- spec/unit/daemon/interruptible_sleep_spec.rb
|
234
238
|
- spec/unit/daemon/logger_spec.rb
|
235
239
|
- spec/unit/daemon_spec.rb
|
240
|
+
- spec/unit/deprecatable_spec.rb
|
241
|
+
- spec/unit/deprecation_spec.rb
|
236
242
|
- spec/unit/gcm/app_spec.rb
|
237
243
|
- spec/unit/gcm/notification_spec.rb
|
238
244
|
- spec/unit/notification_shared.rb
|