rpush 4.1.0 → 4.1.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/lib/generators/rpush_migration_generator.rb +1 -0
- data/lib/generators/templates/rpush_4_1_1_updates.rb +9 -0
- data/lib/rpush/apns_feedback.rb +1 -0
- data/lib/rpush/cli.rb +8 -21
- data/lib/rpush/client/redis/app.rb +2 -1
- data/lib/rpush/daemon.rb +2 -2
- data/lib/rpush/daemon/apns/feedback_receiver.rb +1 -1
- data/lib/rpush/daemon/app_runner.rb +1 -1
- data/lib/rpush/version.rb +1 -1
- data/spec/support/active_record_setup.rb +3 -1
- data/spec/unit/apns_feedback_spec.rb +17 -6
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f974d91d6caa8c660383285d254a61dbb001fd7a4000540cc76b798f77b09d9f
|
4
|
+
data.tar.gz: 3d4fe2bfc3b354b6c25cc47a5a81f0f40e6a3a6b38ac9750fac1c117555e379f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a4d532a9c05739a246454c0194552a84270a4f3dc864f7279cb3ca2671e1fe02bc624ecad001083aa5745c21fd428af04b8aa4833581def109e77a6a5df7207
|
7
|
+
data.tar.gz: 6b1311abb89a2d78e4aa447521815177a6cc7b546665b636685fe600c8219d35833ccc79fae892496b6488f3b444b886395700b09fdb3c76268ecd55e0878ab3
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## 4.1.1 (2019-05-13)
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Allow disabling of APNS feedback for specific Rpush apps [#491](https://github.com/rpush/rpush/pull/491) (by [@drn](https://github.com/drn)).
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
- Switch from ANSI to Rainbow. ([#496](https://github.com/rpush/rpush/pull/496) by [@drn](https://github.com/drn))
|
4
12
|
|
5
13
|
## 4.1.0 (2019-04-17)
|
6
14
|
|
@@ -51,6 +51,7 @@ class RpushMigrationGenerator < Rails::Generators::Base
|
|
51
51
|
add_rpush_migration('rpush_3_3_0_updates')
|
52
52
|
add_rpush_migration('rpush_3_3_1_updates')
|
53
53
|
add_rpush_migration('rpush_4_1_0_updates')
|
54
|
+
add_rpush_migration('rpush_4_1_1_updates')
|
54
55
|
end
|
55
56
|
|
56
57
|
protected
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class Rpush411Updates < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration["#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"] : ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :rpush_apps, :feedback_enabled, :boolean, default: true
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.down
|
7
|
+
remove_column :rpush_apps, :feedback_enabled
|
8
|
+
end
|
9
|
+
end
|
data/lib/rpush/apns_feedback.rb
CHANGED
@@ -7,6 +7,7 @@ module Rpush
|
|
7
7
|
# Redis stores every App type on the same namespace, hence the
|
8
8
|
# additional filtering
|
9
9
|
next unless app.service_name == 'apns'
|
10
|
+
next unless app.feedback_enabled
|
10
11
|
|
11
12
|
receiver = Rpush::Daemon::Apns::FeedbackReceiver.new(app)
|
12
13
|
receiver.check_for_feedback
|
data/lib/rpush/cli.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
require 'thor'
|
4
|
-
require '
|
4
|
+
require 'rainbow'
|
5
5
|
|
6
6
|
module Rpush
|
7
7
|
class CLI < Thor
|
@@ -46,37 +46,29 @@ module Rpush
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
puts
|
49
|
+
puts Rainbow('✔').green
|
50
50
|
end
|
51
51
|
|
52
52
|
desc 'init', 'Initialize Rpush into the current directory'
|
53
53
|
option 'active-record', type: :boolean, desc: 'Install ActiveRecord migrations'
|
54
54
|
def init
|
55
55
|
underscore_option_names
|
56
|
-
check_ruby_version
|
57
56
|
require 'rails/generators'
|
58
57
|
|
59
|
-
puts "* " +
|
58
|
+
puts "* " + Rainbow('Installing config...').green
|
60
59
|
$RPUSH_CONFIG_PATH = default_config_path # rubocop:disable Style/GlobalVars
|
61
60
|
Rails::Generators.invoke('rpush_config')
|
62
61
|
|
63
62
|
install_migrations = options['active_record']
|
64
63
|
|
65
64
|
unless options.key?('active_record')
|
66
|
-
|
67
|
-
until has_answer
|
68
|
-
STDOUT.write "\n* #{ANSI.green { 'Install ActiveRecord migrations?' }} [y/n]: "
|
69
|
-
STDOUT.flush
|
70
|
-
answer = STDIN.gets.chomp.downcase
|
71
|
-
has_answer = %w(y n).include?(answer)
|
72
|
-
end
|
73
|
-
|
65
|
+
answer = ask("\n* #{Rainbow('Install ActiveRecord migrations?').green}", limited_to: %w[y n])
|
74
66
|
install_migrations = answer == 'y'
|
75
67
|
end
|
76
68
|
|
77
69
|
Rails::Generators.invoke('rpush_migration', ['--force']) if install_migrations
|
78
70
|
|
79
|
-
puts "\n* #{
|
71
|
+
puts "\n* #{Rainbow('Next steps:').green}"
|
80
72
|
puts " - Run 'bundle exec rake db:migrate'." if install_migrations
|
81
73
|
puts " - Review and update your configuration in #{default_config_path}."
|
82
74
|
puts " - Create your first app, see https://github.com/rpush/rpush for examples."
|
@@ -111,7 +103,6 @@ module Rpush
|
|
111
103
|
|
112
104
|
def config_setup
|
113
105
|
underscore_option_names
|
114
|
-
check_ruby_version
|
115
106
|
configure_rpush
|
116
107
|
end
|
117
108
|
|
@@ -126,7 +117,7 @@ module Rpush
|
|
126
117
|
ENV['RAILS_ENV'] = options['rails_env']
|
127
118
|
load 'config/environment.rb'
|
128
119
|
Rpush.config.update(options)
|
129
|
-
puts
|
120
|
+
puts Rainbow('✔').green
|
130
121
|
|
131
122
|
return true
|
132
123
|
end
|
@@ -136,7 +127,7 @@ module Rpush
|
|
136
127
|
|
137
128
|
def load_standalone
|
138
129
|
if !File.exist?(options[:config])
|
139
|
-
STDERR.puts(
|
130
|
+
STDERR.puts(Rainbow('ERROR: ').red + "#{options[:config]} does not exist. Please run 'rpush init' to generate it or specify the --config option.")
|
140
131
|
exit 1
|
141
132
|
else
|
142
133
|
load options[:config]
|
@@ -152,10 +143,6 @@ module Rpush
|
|
152
143
|
self.class.default_config_path
|
153
144
|
end
|
154
145
|
|
155
|
-
def check_ruby_version
|
156
|
-
STDERR.puts(ANSI.yellow { 'WARNING: ' } + "You are using an old and unsupported version of Ruby.") if RUBY_VERSION < '2.3.0' && RUBY_ENGINE == 'ruby'
|
157
|
-
end
|
158
|
-
|
159
146
|
def underscore_option_names
|
160
147
|
# Underscore option names so that they map directly to Configuration options.
|
161
148
|
new_options = options.dup
|
@@ -175,7 +162,7 @@ module Rpush
|
|
175
162
|
|
176
163
|
def rpush_process_pid
|
177
164
|
if Rpush.config.pid_file.blank?
|
178
|
-
STDERR.puts(
|
165
|
+
STDERR.puts(Rainbow('ERROR: ').red + 'config.pid_file is not set.')
|
179
166
|
exit 1
|
180
167
|
end
|
181
168
|
|
data/lib/rpush/daemon.rb
CHANGED
@@ -109,7 +109,7 @@ module Rpush
|
|
109
109
|
Feeder.stop
|
110
110
|
AppRunner.stop
|
111
111
|
delete_pid_file
|
112
|
-
puts
|
112
|
+
puts Rainbow('✔').red if Rpush.config.foreground
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -168,7 +168,7 @@ module Rpush
|
|
168
168
|
if Rpush::Daemon::AppRunner.app_ids.count == 0
|
169
169
|
puts <<-EOS
|
170
170
|
|
171
|
-
* #{
|
171
|
+
* #{Rainbow('Is this your first time using Rpush?').green}
|
172
172
|
You need to create an App before you can start using Rpush.
|
173
173
|
Please refer to the documentation at https://github.com/rpush/rpush
|
174
174
|
|
@@ -29,7 +29,7 @@ module Rpush
|
|
29
29
|
Rpush.logger.info("[#{app.name}] Starting #{pluralize(app.connections, 'dispatcher')}... ", true)
|
30
30
|
runner = @runners[app.id] = new(app)
|
31
31
|
runner.start_dispatchers
|
32
|
-
puts
|
32
|
+
puts Rainbow('✔').green if Rpush.config.foreground
|
33
33
|
runner.start_loops
|
34
34
|
rescue StandardError => e
|
35
35
|
@runners.delete(app.id)
|
data/lib/rpush/version.rb
CHANGED
@@ -40,6 +40,7 @@ require 'generators/templates/rpush_3_2_4_updates'
|
|
40
40
|
require 'generators/templates/rpush_3_3_0_updates'
|
41
41
|
require 'generators/templates/rpush_3_3_1_updates'
|
42
42
|
require 'generators/templates/rpush_4_1_0_updates'
|
43
|
+
require 'generators/templates/rpush_4_1_1_updates'
|
43
44
|
|
44
45
|
migrations = [
|
45
46
|
AddRpush,
|
@@ -55,7 +56,8 @@ migrations = [
|
|
55
56
|
Rpush324Updates,
|
56
57
|
Rpush330Updates,
|
57
58
|
Rpush331Updates,
|
58
|
-
Rpush410Updates
|
59
|
+
Rpush410Updates,
|
60
|
+
Rpush411Updates
|
59
61
|
]
|
60
62
|
|
61
63
|
unless ENV['TRAVIS']
|
@@ -1,13 +1,15 @@
|
|
1
1
|
require 'unit_spec_helper'
|
2
2
|
|
3
3
|
describe Rpush, 'apns_feedback' do
|
4
|
-
let!(:apns_app)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
let!(:apns_app) { Rpush::Apns::App.create!(apns_app_params) }
|
5
|
+
let(:apns_app_params) do
|
6
|
+
{
|
7
|
+
name: 'test',
|
8
|
+
environment: 'production',
|
9
|
+
certificate: TEST_CERT
|
10
|
+
}
|
10
11
|
end
|
12
|
+
let!(:gcm_app) { Rpush::Gcm::App.create!(name: 'MyApp', auth_key: 'abc123') }
|
11
13
|
|
12
14
|
let(:receiver) { double(check_for_feedback: nil) }
|
13
15
|
|
@@ -25,4 +27,13 @@ describe Rpush, 'apns_feedback' do
|
|
25
27
|
expect(receiver).to receive(:check_for_feedback)
|
26
28
|
Rpush.apns_feedback
|
27
29
|
end
|
30
|
+
|
31
|
+
context 'feedback disabled' do
|
32
|
+
let(:apns_app_params) { super().merge(feedback_enabled: false) }
|
33
|
+
|
34
|
+
it 'does not initialize feedback receiver' do
|
35
|
+
expect(Rpush::Daemon::Apns::FeedbackReceiver).not_to receive(:new)
|
36
|
+
Rpush.apns_feedback
|
37
|
+
end
|
38
|
+
end
|
28
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Leitch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -115,7 +115,7 @@ dependencies:
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
118
|
+
name: rainbow
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - ">="
|
@@ -282,6 +282,20 @@ dependencies:
|
|
282
282
|
- - ">="
|
283
283
|
- !ruby/object:Gem::Version
|
284
284
|
version: '0'
|
285
|
+
- !ruby/object:Gem::Dependency
|
286
|
+
name: rubocop-performance
|
287
|
+
requirement: !ruby/object:Gem::Requirement
|
288
|
+
requirements:
|
289
|
+
- - ">="
|
290
|
+
- !ruby/object:Gem::Version
|
291
|
+
version: '0'
|
292
|
+
type: :development
|
293
|
+
prerelease: false
|
294
|
+
version_requirements: !ruby/object:Gem::Requirement
|
295
|
+
requirements:
|
296
|
+
- - ">="
|
297
|
+
- !ruby/object:Gem::Version
|
298
|
+
version: '0'
|
285
299
|
- !ruby/object:Gem::Dependency
|
286
300
|
name: byebug
|
287
301
|
requirement: !ruby/object:Gem::Requirement
|
@@ -377,6 +391,7 @@ files:
|
|
377
391
|
- lib/generators/templates/rpush_3_3_0_updates.rb
|
378
392
|
- lib/generators/templates/rpush_3_3_1_updates.rb
|
379
393
|
- lib/generators/templates/rpush_4_1_0_updates.rb
|
394
|
+
- lib/generators/templates/rpush_4_1_1_updates.rb
|
380
395
|
- lib/rpush.rb
|
381
396
|
- lib/rpush/apns_feedback.rb
|
382
397
|
- lib/rpush/cli.rb
|