activity_notification 2.2.2 → 2.2.3

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: d29e3ff0106686c4b32231c8ffcd70fe1046f8eb02c0740c81c814d21eb969ef
4
- data.tar.gz: '0886dc334077573da144b5929dbf623a289796f9a576fe3a0abd04b1bb7ce759'
3
+ metadata.gz: 30c5b3d148d4606e3ebd7c26a14a746180f2ccde5c6197bf28c95aaeceba8d48
4
+ data.tar.gz: 63454217d875157c64d22dd0e15e947912a73d7f6a1bba371cba05a0973ba680
5
5
  SHA512:
6
- metadata.gz: db72a6b3d2babc00e7ae2e6062952719f267ff5c1254e3a187bda52fab18e216f4792fe5de8a4d4ff576bbc2ca6221ef566b559b2916e33f290afa0b5b291961
7
- data.tar.gz: 3e17d6dcae61a97efdfd7ca586503d29c84abd1e137c6ff6ecbf682a78e3ee99132037949f3d44c17c6e8a1ad1f6ddf0a283bf35b325b619aa7e12f37d0c63e7
6
+ metadata.gz: 2c7c724cdf1acb560ed8d02c56f80bc5cddee91fc0537779480efae64a40108f14fdcd55850ca121bf766416dad818dc664bdad196c17ef6ebe38d31c18ed2f2
7
+ data.tar.gz: 604d78217049389797f3508f621b54e0efd0962c075cf8c500d2b957c52e677584f1ec1eeea326bb12570cbe953c02581b248b9dfff54a80328bbf509b9871ee
@@ -0,0 +1,120 @@
1
+ name: build
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '**'
7
+ - '!images'
8
+ pull_request:
9
+ branches:
10
+ - '**'
11
+ - '!images'
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ gemfile:
20
+ - gemfiles/Gemfile.rails-5.0
21
+ - gemfiles/Gemfile.rails-5.1
22
+ - gemfiles/Gemfile.rails-5.2
23
+ - gemfiles/Gemfile.rails-6.0
24
+ - gemfiles/Gemfile.rails-6.1
25
+ - gemfiles/Gemfile.rails-7.0
26
+ orm:
27
+ - active_record
28
+ - mongoid
29
+ - dynamoid
30
+ include:
31
+ # https://www.ruby-lang.org/en/downloads
32
+ - gemfile: gemfiles/Gemfile.rails-5.0
33
+ ruby-version: 2.7.5
34
+ - gemfile: gemfiles/Gemfile.rails-5.1
35
+ ruby-version: 2.7.5
36
+ - gemfile: gemfiles/Gemfile.rails-5.2
37
+ ruby-version: 2.7.5
38
+ - gemfile: gemfiles/Gemfile.rails-6.0
39
+ ruby-version: 3.0.3
40
+ - gemfile: gemfiles/Gemfile.rails-6.1
41
+ ruby-version: 3.0.3
42
+ - gemfile: gemfiles/Gemfile.rails-7.0
43
+ ruby-version: 3.0.3
44
+ - gemfile: Gemfile
45
+ ruby-version: 3.0.3
46
+ orm: active_record
47
+ test-db: mysql
48
+ - gemfile: Gemfile
49
+ ruby-version: 3.0.3
50
+ orm: active_record
51
+ test-db: postgresql
52
+ - gemfile: Gemfile
53
+ ruby-version: 3.0.3
54
+ orm: mongoid
55
+ test-db: mongodb
56
+ - gemfile: Gemfile
57
+ ruby-version: head
58
+ orm: active_record
59
+ allow_failures: 'true'
60
+ exclude:
61
+ - gemfile: gemfiles/Gemfile.rails-6.0
62
+ orm: dynamoid
63
+ - gemfile: gemfiles/Gemfile.rails-6.1
64
+ orm: dynamoid
65
+ - gemfile: gemfiles/Gemfile.rails-7.0
66
+ orm: dynamoid
67
+
68
+ env:
69
+ RAILS_ENV: test
70
+ BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
71
+ AN_ORM: ${{ matrix.orm }}
72
+ AN_TEST_DB: ${{ matrix.test-db }}
73
+ AWS_DEFAULT_REGION: ap-northeast-1
74
+ AWS_ACCESS_KEY_ID: dummy
75
+ AWS_SECRET_ACCESS_KEY: dummy
76
+
77
+ services:
78
+ mysql:
79
+ image: mysql
80
+ ports:
81
+ - 3306:3306
82
+ env:
83
+ MYSQL_ALLOW_EMPTY_PASSWORD: yes
84
+ MYSQL_DATABASE: activity_notification_test
85
+ options: --health-cmd "mysqladmin ping -h 127.0.0.1" --health-interval 10s --health-timeout 5s --health-retries 5
86
+ postgres:
87
+ image: postgres
88
+ ports:
89
+ - 5432:5432
90
+ env:
91
+ POSTGRES_HOST_AUTH_METHOD: trust
92
+ POSTGRES_DB: activity_notification_test
93
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
94
+ mongodb:
95
+ image: mongo
96
+ ports:
97
+ - 27017:27017
98
+ env:
99
+ MONGO_INITDB_DATABASE: activity_notification_test
100
+ options: --health-cmd mongo --health-interval 10s --health-timeout 5s --health-retries 5
101
+
102
+ steps:
103
+ - uses: actions/checkout@v2
104
+ - name: Set up Ruby
105
+ uses: ruby/setup-ruby@v1
106
+ with:
107
+ ruby-version: ${{ matrix.ruby-version }}
108
+ bundler-cache: true
109
+ - name: Install dependencies
110
+ run: |
111
+ bundle install
112
+ bundle update
113
+ - name: Setup Amazon DynamoDB Local
114
+ if: matrix.orm == 'dynamoid'
115
+ run: |
116
+ bin/install_dynamodblocal.sh
117
+ bin/start_dynamodblocal.sh
118
+ - name: Run tests with RSpec
119
+ run: bundle exec rspec
120
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 2.2.3 / 2022-02-12
2
+ [Full Changelog](http://github.com/simukappu/activity_notification/compare/v2.2.2...v2.2.3)
3
+
4
+ Enhancements:
5
+
6
+ * Allow use with Rails 7.0 - [#164](https://github.com/simukappu/activity_notification/issues/164) [#165](https://github.com/simukappu/activity_notification/pull/165)
7
+ * Add *rescue_optional_target_errors* config option to capture errors on optional targets - [#155](https://github.com/simukappu/activity_notification/issues/155) [#156](https://github.com/simukappu/activity_notification/pull/156)
8
+ * Remove type definition from several columns with nullable and multiple type in OpenAPI schema
9
+
1
10
  ## 2.2.2 / 2021-04-18
2
11
  [Full Changelog](http://github.com/simukappu/activity_notification/compare/v2.2.1...v2.2.2)
3
12
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ActivityNotification
2
2
 
3
- [![Build Status](https://travis-ci.com/simukappu/activity_notification.svg?branch=master)](https://travis-ci.com/simukappu/activity_notification)
3
+ [![Build Status](https://github.com/simukappu/activity_notification/actions/workflows/build.yml/badge.svg)](https://github.com/simukappu/activity_notification/actions/workflows/build.yml)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/simukappu/activity_notification/badge.svg?branch=master)](https://coveralls.io/github/simukappu/activity_notification?branch=master)
5
5
  [![Dependency](https://img.shields.io/depfu/simukappu/activity_notification.svg)](https://depfu.com/repos/simukappu/activity_notification)
6
6
  [![Inline docs](http://inch-ci.org/github/simukappu/activity_notification.svg?branch=master)](http://inch-ci.org/github/simukappu/activity_notification)
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
  s.required_ruby_version = '>= 2.1.0'
22
22
 
23
- s.add_dependency 'railties', '>= 5.0.0', '< 6.2'
23
+ s.add_dependency 'railties', '>= 5.0.0', '< 7.1'
24
24
  s.add_dependency 'i18n', '>= 0.5.0'
25
25
  s.add_dependency 'jquery-rails', '>= 3.1.1'
26
26
  s.add_dependency 'swagger-blocks', '>= 3.0.0'
@@ -0,0 +1,28 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '../'
4
+
5
+ gem 'rails', '~> 7.0.0'
6
+ # https://github.com/lynndylanhurley/devise_token_auth/pull/1517
7
+ gem 'devise_token_auth', git: 'https://github.com/lynndylanhurley/devise_token_auth.git'
8
+ # https://jira.mongodb.org/browse/MONGOID-5193
9
+ gem 'mongoid', git: 'https://github.com/mongodb/mongoid.git'
10
+
11
+ gem 'sprockets-rails'
12
+
13
+ group :development do
14
+ gem 'bullet'
15
+ gem 'rack-cors'
16
+ end
17
+
18
+ group :test do
19
+ gem 'rails-controller-testing'
20
+ gem 'ammeter'
21
+ gem 'timecop'
22
+ gem 'committee'
23
+ gem 'committee-rails'
24
+ # gem 'coveralls', require: false
25
+ gem 'coveralls_reborn', require: false
26
+ end
27
+
28
+ gem 'dotenv-rails', groups: [:development, :test]
@@ -542,7 +542,11 @@ module ActivityNotification
542
542
  [optional_target_name, true]
543
543
  rescue => e
544
544
  Rails.logger.error(e)
545
- [optional_target_name, e]
545
+ if ActivityNotification.config.rescue_optional_target_errors
546
+ [optional_target_name, e]
547
+ else
548
+ raise e
549
+ end
546
550
  end
547
551
  else
548
552
  [optional_target_name, false]
@@ -213,6 +213,15 @@ module ActivityNotification
213
213
  # @return [String] Notification API channel prefix for ActionCable.
214
214
  attr_accessor :notification_api_channel_prefix
215
215
 
216
+ # @overload rescue_optional_target_errors
217
+ # Returns whether activity_notification internally rescues optional target errors
218
+ # @return [Boolean] Whether activity_notification internally rescues optional target errors.
219
+ # @overload rescue_optional_target_errors=(value)
220
+ # Sets whether activity_notification internally rescues optional target errors
221
+ # @param [Boolean] rescue_optional_target_errors The new rescue_optional_target_errors
222
+ # @return [Boolean] Whether activity_notification internally rescues optional target errors.
223
+ attr_accessor :rescue_optional_target_errors
224
+
216
225
  # Initialize configuration for ActivityNotification.
217
226
  # These configuration can be overridden in initializer.
218
227
  # @return [Config] A new instance of Config
@@ -242,6 +251,7 @@ module ActivityNotification
242
251
  @action_cable_with_devise = false
243
252
  @notification_channel_prefix = 'activity_notification_channel'
244
253
  @notification_api_channel_prefix = 'activity_notification_api_channel'
254
+ @rescue_optional_target_errors = true
245
255
  end
246
256
 
247
257
  # Sets ORM name for ActivityNotification (:active_record, :mongoid or :dynamodb)
@@ -49,22 +49,22 @@ module ActivityNotification
49
49
  key :example, "Article"
50
50
  end
51
51
  property :group_id do
52
- key :oneOf, [
53
- { type: :integer },
54
- { type: :string },
55
- { nullable: true }
56
- ]
52
+ # key :oneOf, [
53
+ # { type: :integer },
54
+ # { type: :string },
55
+ # { nullable: true }
56
+ # ]
57
57
  key :description, "This parameter type is integer with ActiveRecord, but will be string with Mongoid or Dynamoid ORMs."
58
58
  key :nullable, true
59
59
  key :example, 11
60
60
  end
61
61
  property :group_owner_id do
62
- key :oneOf, [
63
- { type: :integer },
64
- { type: :string },
65
- { type: :object },
66
- { nullable: true }
67
- ]
62
+ # key :oneOf, [
63
+ # { type: :integer },
64
+ # { type: :string },
65
+ # { type: :object },
66
+ # { nullable: true }
67
+ # ]
68
68
  key :description, "This parameter type is integer with ActiveRecord, but will be string or object including $oid with Mongoid or Dynamoid ORMs."
69
69
  key :nullable, true
70
70
  key :example, 123
@@ -75,11 +75,11 @@ module ActivityNotification
75
75
  key :example, "User"
76
76
  end
77
77
  property :notifier_id do
78
- key :oneOf, [
79
- { type: :integer },
80
- { type: :string },
81
- { nullable: true }
82
- ]
78
+ # key :oneOf, [
79
+ # { type: :integer },
80
+ # { type: :string },
81
+ # { nullable: true }
82
+ # ]
83
83
  key :description, "This parameter type is integer with ActiveRecord, but will be string with Mongoid or Dynamoid ORMs."
84
84
  key :nullable, true
85
85
  key :example, 2
@@ -1,3 +1,3 @@
1
1
  module ActivityNotification
2
- VERSION = "2.2.2"
2
+ VERSION = "2.2.3"
3
3
  end
@@ -97,4 +97,8 @@ ActivityNotification.configure do |config|
97
97
  # Configure notification API channel prefix for ActionCable.
98
98
  config.notification_api_channel_prefix = 'activity_notification_api_channel'
99
99
 
100
+ # Configure if activity_notification internally rescues optional target errors. Default value is true.
101
+ # See https://github.com/simukappu/activity_notification/issues/155 for more details.
102
+ config.rescue_optional_target_errors = true
103
+
100
104
  end
@@ -136,9 +136,32 @@ shared_examples_for :notification_api do
136
136
  Comment._optional_targets[:users] = @current_optional_target
137
137
  end
138
138
 
139
- it "generates notifications even if some optional targets raise error" do
140
- notifications = described_class.notify(:users, @comment_2)
141
- expect(notifications.size).to eq(2)
139
+ context "with true as ActivityNotification.config.rescue_optional_target_errors" do
140
+ it "generates notifications even if some optional targets raise error" do
141
+ rescue_optional_target_errors = ActivityNotification.config.rescue_optional_target_errors
142
+ ActivityNotification.config.rescue_optional_target_errors = true
143
+ notifications = described_class.notify(:users, @comment_2)
144
+ expect(notifications.size).to eq(2)
145
+ ActivityNotification.config.rescue_optional_target_errors = rescue_optional_target_errors
146
+ end
147
+ end
148
+
149
+ context "with false as ActivityNotification.config.rescue_optional_target_errors" do
150
+ it "raises an capturable exception" do
151
+ rescue_optional_target_errors = ActivityNotification.config.rescue_optional_target_errors
152
+ ActivityNotification.config.rescue_optional_target_errors = false
153
+ expect { described_class.notify(:users, @comment_2) }.to raise_error(RuntimeError)
154
+ ActivityNotification.config.rescue_optional_target_errors = rescue_optional_target_errors
155
+ end
156
+ end
157
+
158
+ it "allows an exception to be captured to continue" do
159
+ begin
160
+ notifications = described_class.notify(:users, @comment_2)
161
+ expect(notifications.size).to eq(2)
162
+ rescue => e
163
+ next
164
+ end
142
165
  end
143
166
  end
144
167
  end
@@ -23,7 +23,7 @@ mongodb: &mongodb
23
23
  default: &default
24
24
  pool: 5
25
25
  timeout: 5000
26
- host: localhost
26
+ host: 127.0.0.1
27
27
  <<: *<%= ENV['AN_TEST_DB'].blank? ? "sqlite" : ENV['AN_TEST_DB'] %>
28
28
 
29
29
  development:
@@ -97,4 +97,8 @@ ActivityNotification.configure do |config|
97
97
  # Configure notification API channel prefix for ActionCable.
98
98
  config.notification_api_channel_prefix = 'activity_notification_api_channel'
99
99
 
100
+ # Configure if activity_notification internally rescues optional target errors. Default value is true.
101
+ # See https://github.com/simukappu/activity_notification/issues/155 for more details.
102
+ config.rescue_optional_target_errors = true
103
+
100
104
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activity_notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shota Yamazaki
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-18 00:00:00.000000000 Z
11
+ date: 2022-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 5.0.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6.2'
22
+ version: '7.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 5.0.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6.2'
32
+ version: '7.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: i18n
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -316,10 +316,10 @@ files:
316
316
  - ".github/ISSUE_TEMPLATE/bug_report.md"
317
317
  - ".github/ISSUE_TEMPLATE/feature_request.md"
318
318
  - ".github/pull_request_template.md"
319
+ - ".github/workflows/build.yml"
319
320
  - ".gitignore"
320
321
  - ".rspec"
321
322
  - ".rubocop.yml"
322
- - ".travis.yml"
323
323
  - ".yardopts"
324
324
  - CHANGELOG.md
325
325
  - Gemfile
@@ -390,6 +390,7 @@ files:
390
390
  - gemfiles/Gemfile.rails-5.2
391
391
  - gemfiles/Gemfile.rails-6.0
392
392
  - gemfiles/Gemfile.rails-6.1
393
+ - gemfiles/Gemfile.rails-7.0
393
394
  - lib/activity_notification.rb
394
395
  - lib/activity_notification/apis/notification_api.rb
395
396
  - lib/activity_notification/apis/subscription_api.rb
@@ -667,7 +668,7 @@ homepage: https://github.com/simukappu/activity_notification
667
668
  licenses:
668
669
  - MIT
669
670
  metadata: {}
670
- post_install_message:
671
+ post_install_message:
671
672
  rdoc_options: []
672
673
  require_paths:
673
674
  - lib
@@ -682,8 +683,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
682
683
  - !ruby/object:Gem::Version
683
684
  version: '0'
684
685
  requirements: []
685
- rubygems_version: 3.1.4
686
- signing_key:
686
+ rubygems_version: 3.2.32
687
+ signing_key:
687
688
  specification_version: 4
688
689
  summary: Integrated user activity notifications for Ruby on Rails
689
690
  test_files:
data/.travis.yml DELETED
@@ -1,70 +0,0 @@
1
- language: ruby
2
-
3
- branches:
4
- except:
5
- - images
6
-
7
- rvm:
8
- - 2.7.2
9
- # - 2.6.6
10
- # - 2.5.8
11
- # - 2.4.10 #EOL
12
- # - 2.3.8 #EOL
13
-
14
- gemfile:
15
- - gemfiles/Gemfile.rails-5.0
16
- - gemfiles/Gemfile.rails-5.1
17
- - gemfiles/Gemfile.rails-5.2
18
- - gemfiles/Gemfile.rails-6.0
19
- - gemfiles/Gemfile.rails-6.1
20
-
21
- env:
22
- - AN_ORM=active_record
23
- - AN_ORM=active_record AN_TEST_DB=mysql
24
- - AN_ORM=active_record AN_TEST_DB=postgresql
25
- - AN_ORM=mongoid
26
- - AN_ORM=mongoid AN_TEST_DB=mongodb
27
- - AN_ORM=dynamoid
28
-
29
- matrix:
30
- include:
31
- - rvm: ruby-head
32
- gemfile: Gemfile
33
- env: AN_ORM=active_record
34
- - rvm: ruby-head
35
- gemfile: Gemfile
36
- env: AN_ORM=mongoid
37
- - rvm: ruby-head
38
- gemfile: Gemfile
39
- env: AN_ORM=dynamoid
40
- exclude:
41
- - gemfile: gemfiles/Gemfile.rails-6.1
42
- env: AN_ORM=dynamoid
43
- allow_failures:
44
- - rvm: ruby-head
45
- fast_finish: true
46
-
47
- services:
48
- - mysql
49
- - postgresql
50
- - mongodb
51
-
52
- sudo: false
53
-
54
- cache: bundler
55
-
56
- install:
57
- - bundle install
58
- - if [ "$AN_ORM" = "dynamoid" ]; then bin/install_dynamodblocal.sh; fi
59
-
60
- before_script:
61
- - bundle update
62
- - if [ "$AN_TEST_DB" = "mysql" ]; then mysql -e 'create database activity_notification_test'; fi
63
- - if [ "$AN_TEST_DB" = "postgresql" ]; then psql -c 'create database activity_notification_test' -U postgres; fi
64
- - if [ "$AN_ORM" = "dynamoid" ]; then bin/start_dynamodblocal.sh; fi
65
- - if [ "$AN_ORM" = "dynamoid" ]; then export AWS_DEFAULT_REGION=ap-northeast-1 AWS_ACCESS_KEY_ID=dummy AWS_SECRET_ACCESS_KEY=dummy; fi
66
-
67
- script: bundle exec rspec
68
-
69
- notifications:
70
- email: true