push-core 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -12,21 +12,21 @@
|
|
12
12
|
|
13
13
|
Add to your `GemFile`
|
14
14
|
|
15
|
-
gem push-core
|
15
|
+
gem 'push-core'
|
16
16
|
|
17
17
|
and add the push provider to you Gemfile:
|
18
18
|
|
19
19
|
For __APNS__ (iOS: Apple Push Notification Services):
|
20
20
|
|
21
|
-
gem push-apns
|
22
|
-
|
21
|
+
gem 'push-apns'
|
22
|
+
|
23
23
|
For __C2DM__ (Android: Cloud to Device Messaging, deprecated by Google, not this gem):
|
24
24
|
|
25
|
-
gem push-c2dm
|
25
|
+
gem 'push-c2dm'
|
26
26
|
|
27
27
|
For __GCM__ (Android: Google Cloud Messaging):
|
28
28
|
|
29
|
-
gem push-gcm
|
29
|
+
gem 'push-gcm'
|
30
30
|
|
31
31
|
And run `bundle install` to install the gems.
|
32
32
|
|
@@ -73,7 +73,7 @@ You can have each provider per app_name and you can have more than one app_name.
|
|
73
73
|
7. Convert the certificate to a .pem, where `<environment>` should be `development` or `production`, depending on the certificate you exported.
|
74
74
|
|
75
75
|
`openssl pkcs12 -nodes -clcerts -in cert.p12 -out <environment>.pem`
|
76
|
-
|
76
|
+
|
77
77
|
8. Move the .pem file somewhere where you can use the `File.read` to load the file in the database.
|
78
78
|
|
79
79
|
## Daemon
|
@@ -81,7 +81,7 @@ You can have each provider per app_name and you can have more than one app_name.
|
|
81
81
|
To start the daemon:
|
82
82
|
|
83
83
|
bundle exec push <environment> <options>
|
84
|
-
|
84
|
+
|
85
85
|
Where `<environment>` is your Rails environment and `<options>` can be:
|
86
86
|
|
87
87
|
-f, --foreground Run in the foreground. Log is not written.
|
@@ -103,7 +103,7 @@ Push::MessageApns.create(
|
|
103
103
|
alert: 'Hello World',
|
104
104
|
sound: '1.aiff',
|
105
105
|
badge: 1,
|
106
|
-
expiry: 1.day.to_i,
|
106
|
+
expiry: 1.day.to_i,
|
107
107
|
attributes_for_device: {key: 'MSG'})
|
108
108
|
```
|
109
109
|
C2DM:
|
data/lib/push/daemon.rb
CHANGED
@@ -39,12 +39,17 @@ module Push
|
|
39
39
|
protected
|
40
40
|
|
41
41
|
def self.rescale_poolsize(size)
|
42
|
+
h = ActiveRecord::Base.connection_config
|
42
43
|
# 1 feeder + providers
|
43
|
-
|
44
|
+
h[:pool] = 1 + size
|
44
45
|
|
45
|
-
|
46
|
-
|
46
|
+
# save the adjustments in the configuration
|
47
|
+
ActiveRecord::Base.configurations[ENV['RAILS_ENV']] = h
|
48
|
+
|
49
|
+
# apply new configuration
|
50
|
+
ActiveRecord::Base.clear_all_connections!
|
47
51
|
ActiveRecord::Base.establish_connection(h)
|
52
|
+
|
48
53
|
logger.info("[Daemon] Rescaled ActiveRecord ConnectionPool size to #{size}")
|
49
54
|
end
|
50
55
|
|
@@ -2,7 +2,7 @@ module Push
|
|
2
2
|
module Daemon
|
3
3
|
module DatabaseReconnectable
|
4
4
|
def adaptor_errors
|
5
|
-
errors = [ActiveRecord::StatementInvalid]
|
5
|
+
errors = [ActiveRecord::StatementInvalid, ActiveRecord::ConnectionNotEstablished]
|
6
6
|
errors << PGError if defined?(PGError)
|
7
7
|
errors << Mysql2::Error if defined?(Mysql2)
|
8
8
|
errors
|
@@ -37,7 +37,7 @@ module Push
|
|
37
37
|
|
38
38
|
def reconnect_database
|
39
39
|
ActiveRecord::Base.clear_all_connections!
|
40
|
-
ActiveRecord::Base.establish_connection
|
40
|
+
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[ENV['RAILS_ENV']])
|
41
41
|
end
|
42
42
|
|
43
43
|
def check_database_is_connected
|
data/lib/push/daemon/logger.rb
CHANGED
data/lib/push/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: push-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70126762372120 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.2.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70126762372120
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &70126762371220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70126762371220
|
36
36
|
description: Push daemon for push notification services like APNS (iOS/Apple) and
|
37
37
|
GCM/C2DM (Android).
|
38
38
|
email:
|