rpush 2.2.0-java → 2.3.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/README.md +17 -9
  4. data/lib/generators/rpush_migration_generator.rb +1 -1
  5. data/lib/rpush.rb +4 -1
  6. data/lib/rpush/apns_feedback.rb +1 -1
  7. data/lib/rpush/cli.rb +24 -21
  8. data/lib/rpush/client/active_model/apns/app.rb +1 -1
  9. data/lib/rpush/client/active_model/apns/notification.rb +2 -2
  10. data/lib/rpush/client/active_model/wpns/notification.rb +7 -1
  11. data/lib/rpush/configuration.rb +32 -22
  12. data/lib/rpush/daemon.rb +18 -9
  13. data/lib/rpush/daemon/adm/delivery.rb +4 -1
  14. data/lib/rpush/daemon/apns/delivery.rb +3 -0
  15. data/lib/rpush/daemon/apns/feedback_receiver.rb +6 -2
  16. data/lib/rpush/daemon/app_runner.rb +11 -16
  17. data/lib/rpush/daemon/batch.rb +9 -0
  18. data/lib/rpush/daemon/delivery.rb +10 -2
  19. data/lib/rpush/daemon/delivery_error.rb +3 -3
  20. data/lib/rpush/daemon/dispatcher/apns_tcp.rb +11 -11
  21. data/lib/rpush/daemon/dispatcher/tcp.rb +2 -10
  22. data/lib/rpush/daemon/gcm/delivery.rb +13 -7
  23. data/lib/rpush/daemon/signal_handler.rb +5 -3
  24. data/lib/rpush/daemon/store/active_record.rb +14 -0
  25. data/lib/rpush/daemon/store/interface.rb +2 -1
  26. data/lib/rpush/daemon/store/redis.rb +3 -0
  27. data/lib/rpush/daemon/tcp_connection.rb +47 -17
  28. data/lib/rpush/daemon/wpns/delivery.rb +19 -10
  29. data/lib/rpush/logger.rb +30 -12
  30. data/lib/rpush/plugin.rb +44 -0
  31. data/lib/rpush/push.rb +1 -1
  32. data/lib/rpush/reflectable.rb +13 -0
  33. data/lib/rpush/{reflection.rb → reflection_collection.rb} +1 -9
  34. data/lib/rpush/reflection_public_methods.rb +9 -0
  35. data/lib/rpush/version.rb +1 -1
  36. data/lib/tasks/test.rake +6 -4
  37. data/spec/functional/adm_spec.rb +12 -0
  38. data/spec/functional/apns_spec.rb +61 -42
  39. data/spec/functional/gcm_spec.rb +9 -0
  40. data/spec/functional/retry_spec.rb +1 -1
  41. data/spec/functional/wpns_spec.rb +44 -11
  42. data/spec/spec_helper.rb +2 -0
  43. data/spec/unit/apns_feedback_spec.rb +2 -2
  44. data/spec/unit/client/active_record/apns/app_spec.rb +2 -2
  45. data/spec/unit/client/active_record/apns/notification_spec.rb +1 -2
  46. data/spec/unit/client/active_record/wpns/notification_spec.rb +9 -3
  47. data/spec/unit/configuration_spec.rb +1 -0
  48. data/spec/unit/daemon/adm/delivery_spec.rb +0 -1
  49. data/spec/unit/daemon/apns/feedback_receiver_spec.rb +0 -1
  50. data/spec/unit/daemon/app_runner_spec.rb +14 -9
  51. data/spec/unit/daemon/delivery_spec.rb +0 -1
  52. data/spec/unit/daemon/dispatcher/tcp_spec.rb +0 -7
  53. data/spec/unit/daemon/gcm/delivery_spec.rb +1 -1
  54. data/spec/unit/daemon/signal_handler_spec.rb +5 -1
  55. data/spec/unit/daemon/store/active_record_spec.rb +1 -1
  56. data/spec/unit/daemon/tcp_connection_spec.rb +18 -18
  57. data/spec/unit/daemon/wpns/delivery_spec.rb +1 -1
  58. data/spec/unit/daemon_spec.rb +10 -2
  59. data/spec/unit/logger_spec.rb +0 -1
  60. data/spec/unit/plugin_spec.rb +36 -0
  61. data/spec/unit/push_spec.rb +2 -2
  62. data/spec/unit/{daemon/reflectable_spec.rb → reflectable_spec.rb} +6 -6
  63. data/spec/unit/{reflection_spec.rb → reflection_collection_spec.rb} +4 -8
  64. metadata +34 -36
  65. data/lib/rpush/daemon/reflectable.rb +0 -11
  66. data/spec/integration/rpush_spec.rb +0 -13
  67. data/spec/integration/support/gcm_success_response.json +0 -1
  68. data/spec/support/install.sh +0 -68
@@ -2,7 +2,7 @@ require 'unit_spec_helper'
2
2
 
3
3
  describe Rpush::Daemon::Wpns::Delivery do
4
4
  let(:app) { Rpush::Wpns::App.create!(name: "MyApp") }
5
- let(:notification) { Rpush::Wpns::Notification.create!(app: app, alert: "test", uri: "http://some.example/", deliver_after: Time.now) }
5
+ let(:notification) { Rpush::Wpns::Notification.create!(app: app, data: { title: "MyApp", body: "Example notification", param: "/param1" }, uri: "http://some.example/", deliver_after: Time.now) }
6
6
  let(:logger) { double(error: nil, info: nil, warn: nil) }
7
7
  let(:response) { double(code: 200, header: {}) }
8
8
  let(:http) { double(shutdown: nil, request: response) }
@@ -6,7 +6,7 @@ describe Rpush::Daemon, "when starting" do
6
6
 
7
7
  let(:certificate) { double }
8
8
  let(:password) { double }
9
- let(:logger) { double(:logger, info: nil, error: nil, warn: nil) }
9
+ let(:logger) { double(:logger, info: nil, error: nil, warn: nil, internal_logger: nil) }
10
10
 
11
11
  before do
12
12
  Rpush.stub(logger: logger)
@@ -22,7 +22,7 @@ describe Rpush::Daemon, "when starting" do
22
22
  unless Rpush.jruby?
23
23
  it "forks into a daemon if the foreground option is false" do
24
24
  Rpush.config.foreground = false
25
- Rpush::Daemon.initialize_store
25
+ Rpush::Daemon.common_init
26
26
  Process.should_receive(:daemon)
27
27
  Rpush::Daemon.start
28
28
  end
@@ -63,6 +63,14 @@ describe Rpush::Daemon, "when starting" do
63
63
  Rpush::Daemon.store.should be_kind_of(Rpush::Daemon::Store::ActiveRecord)
64
64
  end
65
65
 
66
+ it 'initializes plugins' do
67
+ plugin = Rpush.plugin(:test)
68
+ did_init = false
69
+ plugin.init { did_init = true }
70
+ Rpush::Daemon.common_init
71
+ expect(did_init).to be_true
72
+ end
73
+
66
74
  it 'logs an error if the store cannot be loaded' do
67
75
  Rpush.config.client = :foo_bar
68
76
  Rpush.logger.should_receive(:error).with(kind_of(LoadError))
@@ -21,7 +21,6 @@ describe Rpush::Logger do
21
21
 
22
22
  it "disables logging if the log file cannot be opened" do
23
23
  File.stub(:open).and_raise(Errno::ENOENT)
24
- STDERR.should_receive(:puts).with(/No such file or directory/)
25
24
  STDERR.should_receive(:puts).with(/Logging disabled/)
26
25
  Rpush::Logger.new
27
26
  end
@@ -0,0 +1,36 @@
1
+ require 'unit_spec_helper'
2
+
3
+ describe Rpush::Plugin do
4
+ include Rpush::Reflectable
5
+
6
+ it 'can only be initialized once' do
7
+ plugin = double(Rpush::Plugin, unload: nil)
8
+ expect(Rpush::Plugin).to receive(:new).once.and_return(plugin)
9
+ Rpush.plugin(:test)
10
+ Rpush.plugin(:test)
11
+ end
12
+
13
+ it 'can be referenced' do
14
+ plugin = Rpush.plugin(:test)
15
+ expect(Rpush.plugins[:test]).to eq(plugin)
16
+ end
17
+
18
+ it 'can be configured' do
19
+ plugin = Rpush.plugin(:test)
20
+ plugin.configure do |config|
21
+ config.is_configured = true
22
+ end
23
+ expect(Rpush.config.plugin.test.is_configured).to be_true
24
+ end
25
+
26
+ it 'can hook up reflections' do
27
+ plugin = Rpush.plugin(:test)
28
+ reflected_error = nil
29
+ plugin.reflect do |on|
30
+ on.error { |error| reflected_error = error }
31
+ end
32
+ error = double
33
+ reflect(:error, error)
34
+ expect(reflected_error).to eq(error)
35
+ end
36
+ end
@@ -12,8 +12,8 @@ describe Rpush, 'push' do
12
12
  Rpush.config.push.should be_true
13
13
  end
14
14
 
15
- it 'initializes the store' do
16
- Rpush::Daemon.should_receive(:initialize_store)
15
+ it 'initializes the daemon' do
16
+ Rpush::Daemon.should_receive(:common_init)
17
17
  Rpush.push
18
18
  end
19
19
 
@@ -1,26 +1,26 @@
1
1
  require 'unit_spec_helper'
2
2
 
3
- describe Rpush::Daemon::Reflectable do
3
+ describe Rpush::Reflectable do
4
4
  class TestReflectable
5
- include Rpush::Daemon::Reflectable
5
+ include Rpush::Reflectable
6
6
  end
7
7
 
8
8
  let(:logger) { double(error: nil) }
9
9
  let(:test_reflectable) { TestReflectable.new }
10
10
 
11
11
  before do
12
- Rpush.reflections.stub(:__dispatch)
12
+ Rpush.reflection_stack[0].stub(:__dispatch)
13
13
  Rpush.stub(logger: logger)
14
14
  end
15
15
 
16
16
  it 'dispatches the given reflection' do
17
- Rpush.reflections.should_receive(:__dispatch).with(:error)
17
+ Rpush.reflection_stack[0].should_receive(:__dispatch).with(:error)
18
18
  test_reflectable.reflect(:error)
19
19
  end
20
20
 
21
- it 'logs errors raise by the reflection' do
21
+ it 'logs errors raised by the reflection' do
22
22
  error = StandardError.new
23
- Rpush.reflections.stub(:__dispatch).and_raise(error)
23
+ Rpush.reflection_stack[0].stub(:__dispatch).and_raise(error)
24
24
  Rpush.logger.should_receive(:error).with(error)
25
25
  test_reflectable.reflect(:error)
26
26
  end
@@ -6,25 +6,21 @@
6
6
  Rpush.reflect { did_yield = true }
7
7
  did_yield.should be_true
8
8
  end
9
-
10
- it 'returns all reflections' do
11
- Rpush.reflections.should be_kind_of(Rpush::Reflections)
12
- end
13
9
  end
14
10
 
15
- describe Rpush::Reflections do
11
+ describe Rpush::ReflectionCollection do
16
12
  it 'dispatches the given reflection' do
17
13
  did_yield = false
18
14
  Rpush.reflect do |on|
19
15
  on.error { did_yield = true }
20
16
  end
21
- Rpush.reflections.__dispatch(:error)
17
+ Rpush.reflection_stack[0].__dispatch(:error)
22
18
  did_yield.should be_true
23
19
  end
24
20
 
25
21
  it 'raises an error when trying to dispatch and unknown reflection' do
26
22
  expect do
27
- Rpush.reflections.__dispatch(:unknown)
28
- end.to raise_error(Rpush::Reflections::NoSuchReflectionError)
23
+ Rpush.reflection_stack[0].__dispatch(:unknown)
24
+ end.to raise_error(Rpush::ReflectionCollection::NoSuchReflectionError)
29
25
  end
30
26
  end
metadata CHANGED
@@ -1,127 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpush
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: java
6
6
  authors:
7
7
  - Ian Leitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-08 00:00:00.000000000 Z
11
+ date: 2015-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: multi_json
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: '1.0'
20
14
  requirement: !ruby/object:Gem::Requirement
21
15
  requirements:
22
16
  - - ~>
23
17
  - !ruby/object:Gem::Version
24
18
  version: '1.0'
19
+ name: multi_json
25
20
  prerelease: false
26
21
  type: :runtime
27
- - !ruby/object:Gem::Dependency
28
- name: net-http-persistent
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
- - - '>='
24
+ - - ~>
32
25
  - !ruby/object:Gem::Version
33
- version: '0'
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
34
28
  requirement: !ruby/object:Gem::Requirement
35
29
  requirements:
36
30
  - - '>='
37
31
  - !ruby/object:Gem::Version
38
32
  version: '0'
33
+ name: net-http-persistent
39
34
  prerelease: false
40
35
  type: :runtime
41
- - !ruby/object:Gem::Dependency
42
- name: activesupport
43
36
  version_requirements: !ruby/object:Gem::Requirement
44
37
  requirements:
45
38
  - - '>='
46
39
  - !ruby/object:Gem::Version
47
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
48
42
  requirement: !ruby/object:Gem::Requirement
49
43
  requirements:
50
44
  - - '>='
51
45
  - !ruby/object:Gem::Version
52
46
  version: '0'
47
+ name: activesupport
53
48
  prerelease: false
54
49
  type: :runtime
55
- - !ruby/object:Gem::Dependency
56
- name: thor
57
50
  version_requirements: !ruby/object:Gem::Requirement
58
51
  requirements:
59
52
  - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
62
56
  requirement: !ruby/object:Gem::Requirement
63
57
  requirements:
64
58
  - - '>='
65
59
  - !ruby/object:Gem::Version
66
60
  version: '0'
61
+ name: thor
67
62
  prerelease: false
68
63
  type: :runtime
69
- - !ruby/object:Gem::Dependency
70
- name: railties
71
64
  version_requirements: !ruby/object:Gem::Requirement
72
65
  requirements:
73
66
  - - '>='
74
67
  - !ruby/object:Gem::Version
75
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
76
70
  requirement: !ruby/object:Gem::Requirement
77
71
  requirements:
78
72
  - - '>='
79
73
  - !ruby/object:Gem::Version
80
74
  version: '0'
75
+ name: railties
81
76
  prerelease: false
82
77
  type: :runtime
83
- - !ruby/object:Gem::Dependency
84
- name: term-ansicolor
85
78
  version_requirements: !ruby/object:Gem::Requirement
86
79
  requirements:
87
80
  - - '>='
88
81
  - !ruby/object:Gem::Version
89
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
90
84
  requirement: !ruby/object:Gem::Requirement
91
85
  requirements:
92
86
  - - '>='
93
87
  - !ruby/object:Gem::Version
94
88
  version: '0'
89
+ name: ansi
95
90
  prerelease: false
96
91
  type: :runtime
97
- - !ruby/object:Gem::Dependency
98
- name: jruby-openssl
99
92
  version_requirements: !ruby/object:Gem::Requirement
100
93
  requirements:
101
94
  - - '>='
102
95
  - !ruby/object:Gem::Version
103
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
104
98
  requirement: !ruby/object:Gem::Requirement
105
99
  requirements:
106
100
  - - '>='
107
101
  - !ruby/object:Gem::Version
108
102
  version: '0'
103
+ name: jruby-openssl
109
104
  prerelease: false
110
105
  type: :runtime
111
- - !ruby/object:Gem::Dependency
112
- name: activerecord-jdbc-adapter
113
106
  version_requirements: !ruby/object:Gem::Requirement
114
107
  requirements:
115
108
  - - '>='
116
109
  - !ruby/object:Gem::Version
117
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
118
112
  requirement: !ruby/object:Gem::Requirement
119
113
  requirements:
120
114
  - - '>='
121
115
  - !ruby/object:Gem::Version
122
116
  version: '0'
117
+ name: activerecord-jdbc-adapter
123
118
  prerelease: false
124
119
  type: :runtime
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
125
  description: The push notification service for Ruby.
126
126
  email:
127
127
  - port001@gmail.com
@@ -216,7 +216,6 @@ files:
216
216
  - lib/rpush/daemon/loggable.rb
217
217
  - lib/rpush/daemon/proc_title.rb
218
218
  - lib/rpush/daemon/queue_payload.rb
219
- - lib/rpush/daemon/reflectable.rb
220
219
  - lib/rpush/daemon/retry_header_parser.rb
221
220
  - lib/rpush/daemon/retryable_error.rb
222
221
  - lib/rpush/daemon/ring_buffer.rb
@@ -236,8 +235,11 @@ files:
236
235
  - lib/rpush/embed.rb
237
236
  - lib/rpush/logger.rb
238
237
  - lib/rpush/multi_json_helper.rb
238
+ - lib/rpush/plugin.rb
239
239
  - lib/rpush/push.rb
240
- - lib/rpush/reflection.rb
240
+ - lib/rpush/reflectable.rb
241
+ - lib/rpush/reflection_collection.rb
242
+ - lib/rpush/reflection_public_methods.rb
241
243
  - lib/rpush/version.rb
242
244
  - lib/tasks/quality.rake
243
245
  - lib/tasks/test.rake
@@ -251,14 +253,11 @@ files:
251
253
  - spec/functional/synchronization_spec.rb
252
254
  - spec/functional/wpns_spec.rb
253
255
  - spec/functional_spec_helper.rb
254
- - spec/integration/rpush_spec.rb
255
- - spec/integration/support/gcm_success_response.json
256
256
  - spec/spec_helper.rb
257
257
  - spec/support/active_record_setup.rb
258
258
  - spec/support/cert_with_password.pem
259
259
  - spec/support/cert_without_password.pem
260
260
  - spec/support/config/database.yml
261
- - spec/support/install.sh
262
261
  - spec/support/simplecov_helper.rb
263
262
  - spec/support/simplecov_quality_formatter.rb
264
263
  - spec/tmp/.gitkeep
@@ -288,7 +287,6 @@ files:
288
287
  - spec/unit/daemon/dispatcher_loop_spec.rb
289
288
  - spec/unit/daemon/feeder_spec.rb
290
289
  - spec/unit/daemon/gcm/delivery_spec.rb
291
- - spec/unit/daemon/reflectable_spec.rb
292
290
  - spec/unit/daemon/retryable_error_spec.rb
293
291
  - spec/unit/daemon/service_config_methods_spec.rb
294
292
  - spec/unit/daemon/signal_handler_spec.rb
@@ -302,8 +300,10 @@ files:
302
300
  - spec/unit/embed_spec.rb
303
301
  - spec/unit/logger_spec.rb
304
302
  - spec/unit/notification_shared.rb
303
+ - spec/unit/plugin_spec.rb
305
304
  - spec/unit/push_spec.rb
306
- - spec/unit/reflection_spec.rb
305
+ - spec/unit/reflectable_spec.rb
306
+ - spec/unit/reflection_collection_spec.rb
307
307
  - spec/unit/rpush_spec.rb
308
308
  - spec/unit_spec_helper.rb
309
309
  - bin/rpush
@@ -342,14 +342,11 @@ test_files:
342
342
  - spec/functional/synchronization_spec.rb
343
343
  - spec/functional/wpns_spec.rb
344
344
  - spec/functional_spec_helper.rb
345
- - spec/integration/rpush_spec.rb
346
- - spec/integration/support/gcm_success_response.json
347
345
  - spec/spec_helper.rb
348
346
  - spec/support/active_record_setup.rb
349
347
  - spec/support/cert_with_password.pem
350
348
  - spec/support/cert_without_password.pem
351
349
  - spec/support/config/database.yml
352
- - spec/support/install.sh
353
350
  - spec/support/simplecov_helper.rb
354
351
  - spec/support/simplecov_quality_formatter.rb
355
352
  - spec/tmp/.gitkeep
@@ -379,7 +376,6 @@ test_files:
379
376
  - spec/unit/daemon/dispatcher_loop_spec.rb
380
377
  - spec/unit/daemon/feeder_spec.rb
381
378
  - spec/unit/daemon/gcm/delivery_spec.rb
382
- - spec/unit/daemon/reflectable_spec.rb
383
379
  - spec/unit/daemon/retryable_error_spec.rb
384
380
  - spec/unit/daemon/service_config_methods_spec.rb
385
381
  - spec/unit/daemon/signal_handler_spec.rb
@@ -393,7 +389,9 @@ test_files:
393
389
  - spec/unit/embed_spec.rb
394
390
  - spec/unit/logger_spec.rb
395
391
  - spec/unit/notification_shared.rb
392
+ - spec/unit/plugin_spec.rb
396
393
  - spec/unit/push_spec.rb
397
- - spec/unit/reflection_spec.rb
394
+ - spec/unit/reflectable_spec.rb
395
+ - spec/unit/reflection_collection_spec.rb
398
396
  - spec/unit/rpush_spec.rb
399
397
  - spec/unit_spec_helper.rb
@@ -1,11 +0,0 @@
1
- module Rpush
2
- module Daemon
3
- module Reflectable
4
- def reflect(name, *args)
5
- Rpush.reflections.__dispatch(name, *args)
6
- rescue StandardError => e
7
- Rpush.logger.error(e)
8
- end
9
- end
10
- end
11
- end
@@ -1,13 +0,0 @@
1
- # describe "Rpush" do
2
-
3
- # before :all do
4
- # `vagrant up`
5
- # # TODO: Upload current directory.
6
- # # TODO: Use Net::SSH
7
- # `vagrant ssh 'cd rpush; git fetch origin; git reset --hard origin/master; sh tools/run_docker.sh'`
8
- # end
9
-
10
- # it 'can be installed and successfully delivers a notification' do
11
- # # Can now SSH to the Docker instance with; ssh -i docker_key root@localhost -p 2100
12
- # end
13
- # end
@@ -1 +0,0 @@
1
- {"results":[{"message_id": "123"}]}
@@ -1,68 +0,0 @@
1
- set -ev
2
- cp -R /mnt/rpush /rpush
3
- cd /tmp
4
- export HOME=/
5
- export RAILS_NAME=rpush_`date +"%Y%m%d%H%M%S"`
6
- mysqladmin create `echo $RAILS_NAME`_development
7
- gem install --no-ri --no-rdoc rails bundler
8
- rails new $RAILS_NAME -BJTS -d mysql
9
- cd $RAILS_NAME
10
- for gem in sdoc coffee-rails uglifier sass-rails jquery-rails jbuilder turbolinks
11
- do
12
- sed -i.bak -e "s/^[ \t]*gem '$gem'/\# gem '$gem'/g" Gemfile
13
- done
14
-
15
- echo 'gem "rpush", path: "/rpush"' >> Gemfile
16
- bundle
17
- rails g rpush
18
- rake db:migrate
19
-
20
- cat > gcm_server.rb <<EOF
21
- require 'webrick'
22
- server = WEBrick::HTTPServer.new(:Port => 80)
23
- server.mount_proc '/' do |req, res|
24
- res["Content-Type"] = 'application/json'
25
- res.body = File.read('/rpush/spec/integration/support/gcm_success_response.json')
26
- end
27
- server.start
28
- EOF
29
- rails runner gcm_server.rb &
30
-
31
- cat > create_app.rb <<EOF
32
- app = Rpush::Gcm::App.new
33
- app.name = "android_app"
34
- app.auth_key = "123"
35
- app.save!
36
-
37
- n = Rpush::Gcm::Notification.new
38
- n.app = app
39
- n.registration_ids = ["abc"]
40
- n.data = {:message => "hi mom!"}
41
- n.save!
42
- puts n.id
43
- EOF
44
-
45
- export NOTIFICATION_ID=`rails runner create_app.rb`
46
- export RPUSH_GCM_HOST='http://localhost'
47
- rpush development
48
-
49
- cat > check_notification_status.rb <<EOF
50
- n = Rpush::Gcm::Notification.find(ENV["NOTIFICATION_ID"])
51
-
52
- while true do
53
- if n.failed
54
- puts "FAILED"
55
- break
56
- elsif n.delivered
57
- puts "DELIVERED"
58
- break
59
- else
60
- STDOUT.write(".")
61
- STDOUT.flush
62
- end
63
-
64
- sleep 0.2
65
- n.reload
66
- end
67
- EOF
68
- rails runner check_notification_status.rb