rpush 4.1.0 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b2bd0a00817c1d763652f59881b939ede6de72a70ef13f9ee761f4143170f4f
4
- data.tar.gz: 65d645e9b67c459908648c34ceb965e9989831dbd5e61b3d110209e47eb8b1a1
3
+ metadata.gz: f974d91d6caa8c660383285d254a61dbb001fd7a4000540cc76b798f77b09d9f
4
+ data.tar.gz: 3d4fe2bfc3b354b6c25cc47a5a81f0f40e6a3a6b38ac9750fac1c117555e379f
5
5
  SHA512:
6
- metadata.gz: 61d8c34cf01ee4057fc068a69fb1f79ad3b51e9ab22b0dada132b20560f66134edb228f0085a9d9be9b3a0c608973d185ccaa762ee9282740ec17b1913c255cd
7
- data.tar.gz: 9738e9c124d22e3bc981c889b7b6eef59f7e85bf4fd19fb4a23c0b082004107bf178ffa2c9565aaa8cf69c978a98c010dbb4151f7879004c707f630211a06b26
6
+ metadata.gz: 6a4d532a9c05739a246454c0194552a84270a4f3dc864f7279cb3ca2671e1fe02bc624ecad001083aa5745c21fd428af04b8aa4833581def109e77a6a5df7207
7
+ data.tar.gz: 6b1311abb89a2d78e4aa447521815177a6cc7b546665b636685fe600c8219d35833ccc79fae892496b6488f3b444b886395700b09fdb3c76268ecd55e0878ab3
@@ -1,6 +1,14 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
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
@@ -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
@@ -1,7 +1,7 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  require 'thor'
4
- require 'ansi/code'
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 ANSI.green { '✔' }
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 "* " + ANSI.green { 'Installing config...' }
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
- has_answer = false
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* #{ANSI.green { 'Next steps:' }}"
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 ANSI.green { '✔' }
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(ANSI.red { 'ERROR: ' } + "#{options[:config]} does not exist. Please run 'rpush init' to generate it or specify the --config option.")
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(ANSI.red { 'ERROR: ' } + 'config.pid_file is not set.')
165
+ STDERR.puts(Rainbow('ERROR: ').red + 'config.pid_file is not set.')
179
166
  exit 1
180
167
  end
181
168
 
@@ -18,7 +18,8 @@ module Rpush
18
18
  attribute :apn_key_id, :string
19
19
  attribute :team_id, :string
20
20
  attribute :bundle_id, :string
21
-
21
+ attribute :feedback_enabled, :boolean, default: true
22
+
22
23
  index :name
23
24
 
24
25
  validates :name, presence: true
@@ -109,7 +109,7 @@ module Rpush
109
109
  Feeder.stop
110
110
  AppRunner.stop
111
111
  delete_pid_file
112
- puts ANSI.green { '✔' } if Rpush.config.foreground
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
- * #{ANSI.green { 'Is this your first time using Rpush?' }}
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
 
@@ -36,7 +36,7 @@ module Rpush
36
36
  Rpush::Daemon.store.release_connection
37
37
  end
38
38
 
39
- puts ANSI.green { '✔' } if Rpush.config.foreground
39
+ puts Rainbow('✔').green if Rpush.config.foreground
40
40
  end
41
41
 
42
42
  def stop
@@ -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 ANSI.green { '✔' } if Rpush.config.foreground
32
+ puts Rainbow('✔').green if Rpush.config.foreground
33
33
  runner.start_loops
34
34
  rescue StandardError => e
35
35
  @runners.delete(app.id)
@@ -2,7 +2,7 @@ module Rpush
2
2
  module VERSION
3
3
  MAJOR = 4
4
4
  MINOR = 1
5
- TINY = 0
5
+ TINY = 1
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".").freeze
@@ -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) do
5
- Rpush::Apns::App.create!(name: 'test', environment: 'production', certificate: TEST_CERT)
6
- end
7
-
8
- let!(:gcm_app) do
9
- Rpush::Gcm::App.create!(name: 'MyApp', auth_key: 'abc123')
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.0
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-04-17 00:00:00.000000000 Z
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: ansi
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