roqua-support 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +11 -27
- data/Appraisals +6 -7
- data/CHANGELOG.md +7 -0
- data/Gemfile +4 -3
- data/Gemfile.lock +35 -30
- data/README.md +23 -0
- data/gemfiles/rails52.gemfile +3 -3
- data/gemfiles/rails60.gemfile +2 -3
- data/gemfiles/{rails51.gemfile → rails61.gemfile} +4 -4
- data/lib/roqua-support/version.rb +1 -1
- data/lib/roqua/core_ext/active_interaction/filters/date_time_as_unix_extension.rb +4 -4
- data/lib/roqua/scheduling/scheduler.rb +4 -1
- data/lib/roqua/support/errors.rb +4 -1
- data/lib/roqua/type.rb +7 -0
- data/lib/roqua/type/stripped_string.rb +34 -0
- data/lib/roqua/validators/subset_validator.rb +1 -1
- data/roqua-support.gemspec +4 -4
- data/spec/roqua/scheduling/scheduler_spec.rb +1 -1
- data/spec/roqua/support/errors_spec.rb +7 -2
- data/spec/roqua/type/stripped_string_spec.rb +34 -0
- metadata +22 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba331b8cd7288dd98818cc40f6bd94eb5a7b4de085536b2acaae63be5fa7bf68
|
4
|
+
data.tar.gz: d003572377199b362bb14c681620013f7db75edf7a02a6be2a3661b4dae17edb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f5ca88d5af226aca07fb1d8b212c15ece4b719d13dbbe0bd64fff263c50b8e50d4ed857058694b594d444f100c0e5bc01a59775579d382d3060b6f5b04950fa
|
7
|
+
data.tar.gz: 15a161ebb389456b0e3a91ac7f9545c43091596793c03d7167bb6b00532e54cac5a4d7c0f520b12dd89aab8905d2ab21d446cf6e40f09029e9a1c6d8bd84ab7a
|
data/.gitlab-ci.yml
CHANGED
@@ -5,44 +5,28 @@ before_script:
|
|
5
5
|
- if [ -x "$(command -v apk)" ]; then apk add sqlite-dev; fi
|
6
6
|
- export BUNDLE_PATH=$CI_PROJECT_DIR/.gems
|
7
7
|
- bundle --jobs 2 --retry 3
|
8
|
-
- bundle exec appraisal
|
9
|
-
- bundle --jobs 2 --retry 3
|
8
|
+
- bundle exec appraisal install
|
10
9
|
|
11
|
-
.ruby_25: &ruby_25
|
12
|
-
image: registry.roqua.nl/roqua/docker-base-images:ruby-2.5
|
13
|
-
cache:
|
14
|
-
key: ruby_25
|
15
|
-
paths:
|
16
|
-
- .gems
|
17
10
|
|
18
|
-
.
|
19
|
-
image: registry.roqua.nl/roqua/docker-base-images:ruby-2.
|
11
|
+
.ruby_27: &ruby_27
|
12
|
+
image: registry.roqua.nl/roqua/docker-base-images:ruby-2.7-builder
|
20
13
|
cache:
|
21
|
-
key:
|
14
|
+
key: ruby_27
|
22
15
|
paths:
|
23
16
|
- .gems
|
24
17
|
|
25
|
-
rails_51_ruby_25:
|
26
|
-
<<: *ruby_25
|
27
|
-
script:
|
28
|
-
- bundle exec appraisal rails51 bundle exec rspec
|
29
18
|
|
30
|
-
|
31
|
-
<<: *
|
19
|
+
rails_52_ruby_27:
|
20
|
+
<<: *ruby_27
|
32
21
|
script:
|
33
22
|
- bundle exec appraisal rails52 bundle exec rspec
|
34
23
|
|
35
|
-
|
36
|
-
<<: *
|
37
|
-
script:
|
38
|
-
- bundle exec appraisal rails52 bundle exec rspec
|
39
|
-
|
40
|
-
rails_60_ruby_25:
|
41
|
-
<<: *ruby_25
|
24
|
+
rails_60_ruby_27:
|
25
|
+
<<: *ruby_27
|
42
26
|
script:
|
43
27
|
- bundle exec appraisal rails60 bundle exec rspec
|
44
28
|
|
45
|
-
|
46
|
-
<<: *
|
29
|
+
rails_61_ruby_27:
|
30
|
+
<<: *ruby_27
|
47
31
|
script:
|
48
|
-
- bundle exec appraisal
|
32
|
+
- bundle exec appraisal rails61 bundle exec rspec
|
data/Appraisals
CHANGED
@@ -1,16 +1,15 @@
|
|
1
|
-
appraise "rails51" do
|
2
|
-
gem "activesupport", "~> 5.1.0"
|
3
|
-
gem 'sqlite3', '~> 1.3.6'
|
4
|
-
end
|
5
|
-
|
6
1
|
appraise "rails52" do
|
2
|
+
gem "active_interaction", "~> 3.0"
|
7
3
|
gem "activesupport", "~> 5.2.0"
|
8
|
-
gem 'sqlite3', '~> 1.4'
|
9
4
|
gem 'appsignal', '~> 2.9.8' # test each minor versions we support
|
10
5
|
end
|
11
6
|
|
12
7
|
appraise "rails60" do
|
13
8
|
gem "activesupport", "~> 6.0.0"
|
14
|
-
gem 'sqlite3', '~> 1.4'
|
15
9
|
gem 'appsignal', '~> 2.10.6'
|
16
10
|
end
|
11
|
+
|
12
|
+
appraise "rails61" do
|
13
|
+
gem "activesupport", "~> 6.1.0"
|
14
|
+
gem 'appsignal', '~> 3.0.0'
|
15
|
+
end
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -4,11 +4,12 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
gem 'appraisal'
|
7
|
-
|
7
|
+
# fix so long as we support ruby 2.6 and ealier.
|
8
|
+
gem 'roqua_styleguide', git: 'https://gitlab.roqua.nl/roqua/styleguide.git', ref: '9662550'
|
8
9
|
|
9
10
|
group :test do
|
11
|
+
gem 'sqlite3'
|
10
12
|
gem 'actionpack', '>= 4.0'
|
11
|
-
gem 'active_interaction', '~> 3.0'
|
12
13
|
gem 'climate_control' # For ENV modification in specs
|
13
14
|
gem 'combustion', '~> 1.1.1'
|
14
15
|
gem 'fakefs', require: 'fakefs/safe'
|
@@ -17,4 +18,4 @@ group :test do
|
|
17
18
|
gem 'rspec-instrumentation-matcher'
|
18
19
|
gem 'rspec-rails'
|
19
20
|
gem 'pry'
|
20
|
-
end
|
21
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
GIT
|
2
2
|
remote: https://gitlab.roqua.nl/roqua/styleguide.git
|
3
|
-
revision:
|
3
|
+
revision: 9662550201987db20c03e300eddb34d8ad035613
|
4
|
+
ref: 9662550
|
4
5
|
specs:
|
5
6
|
roqua_styleguide (0.0.8)
|
6
|
-
rubocop (~> 0.
|
7
|
+
rubocop (~> 0.90.0)
|
7
8
|
rubocop-rails
|
8
9
|
|
9
10
|
PATH
|
10
11
|
remote: .
|
11
12
|
specs:
|
12
|
-
roqua-support (0.
|
13
|
-
active_interaction (
|
14
|
-
activesupport (>= 5.
|
15
|
-
appsignal (>= 2.9, <
|
13
|
+
roqua-support (0.4.0)
|
14
|
+
active_interaction (>= 3.0, < 5.0)
|
15
|
+
activesupport (>= 5.2, < 6.2)
|
16
|
+
appsignal (>= 2.9, < 3.1)
|
16
17
|
naught (~> 1.0)
|
17
18
|
with_advisory_lock (~> 3.2)
|
18
19
|
|
@@ -32,8 +33,8 @@ GEM
|
|
32
33
|
erubi (~> 1.4)
|
33
34
|
rails-dom-testing (~> 2.0)
|
34
35
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
35
|
-
active_interaction (
|
36
|
-
activemodel (>=
|
36
|
+
active_interaction (4.0.0)
|
37
|
+
activemodel (>= 5, < 7)
|
37
38
|
activemodel (6.0.2.2)
|
38
39
|
activesupport (= 6.0.2.2)
|
39
40
|
activerecord (6.0.2.2)
|
@@ -49,9 +50,9 @@ GEM
|
|
49
50
|
bundler
|
50
51
|
rake
|
51
52
|
thor (>= 0.14.0)
|
52
|
-
appsignal (
|
53
|
+
appsignal (3.0.2)
|
53
54
|
rack
|
54
|
-
ast (2.4.
|
55
|
+
ast (2.4.2)
|
55
56
|
builder (3.2.4)
|
56
57
|
climate_control (0.2.0)
|
57
58
|
coderay (1.1.2)
|
@@ -59,7 +60,7 @@ GEM
|
|
59
60
|
activesupport (>= 3.0.0)
|
60
61
|
railties (>= 3.0.0)
|
61
62
|
thor (>= 0.14.6)
|
62
|
-
concurrent-ruby (1.1.
|
63
|
+
concurrent-ruby (1.1.8)
|
63
64
|
crass (1.0.6)
|
64
65
|
delayed_job (4.1.8)
|
65
66
|
activesupport (>= 3.0, < 6.1)
|
@@ -83,9 +84,8 @@ GEM
|
|
83
84
|
guard-rspec (4.2.10)
|
84
85
|
guard (~> 2.1)
|
85
86
|
rspec (>= 2.14, < 4.0)
|
86
|
-
i18n (1.8.
|
87
|
+
i18n (1.8.10)
|
87
88
|
concurrent-ruby (~> 1.0)
|
88
|
-
jaro_winkler (1.5.4)
|
89
89
|
listen (3.2.1)
|
90
90
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
91
91
|
rb-inotify (~> 0.9, >= 0.9.10)
|
@@ -95,7 +95,7 @@ GEM
|
|
95
95
|
lumberjack (1.2.4)
|
96
96
|
method_source (1.0.0)
|
97
97
|
mini_portile2 (2.4.0)
|
98
|
-
minitest (5.14.
|
98
|
+
minitest (5.14.4)
|
99
99
|
naught (1.1.0)
|
100
100
|
nenv (0.3.0)
|
101
101
|
nokogiri (1.10.9)
|
@@ -103,13 +103,13 @@ GEM
|
|
103
103
|
notiffany (0.1.3)
|
104
104
|
nenv (~> 0.1)
|
105
105
|
shellany (~> 0.0)
|
106
|
-
parallel (1.
|
107
|
-
parser (
|
108
|
-
ast (~> 2.4.
|
106
|
+
parallel (1.20.1)
|
107
|
+
parser (3.0.0.0)
|
108
|
+
ast (~> 2.4.1)
|
109
109
|
pry (0.13.1)
|
110
110
|
coderay (~> 1.1)
|
111
111
|
method_source (~> 1.0)
|
112
|
-
rack (2.2.
|
112
|
+
rack (2.2.3)
|
113
113
|
rack-test (1.1.0)
|
114
114
|
rack (>= 1.0, < 3)
|
115
115
|
rails-dom-testing (2.0.3)
|
@@ -128,6 +128,7 @@ GEM
|
|
128
128
|
rb-fsevent (0.10.4)
|
129
129
|
rb-inotify (0.10.1)
|
130
130
|
ffi (~> 1.0)
|
131
|
+
regexp_parser (2.1.1)
|
131
132
|
responders (3.0.0)
|
132
133
|
actionpack (>= 5.0)
|
133
134
|
railties (>= 5.0)
|
@@ -156,36 +157,39 @@ GEM
|
|
156
157
|
rspec-mocks (~> 3.9)
|
157
158
|
rspec-support (~> 3.9)
|
158
159
|
rspec-support (3.9.3)
|
159
|
-
rubocop (0.
|
160
|
-
jaro_winkler (~> 1.5.1)
|
160
|
+
rubocop (0.90.0)
|
161
161
|
parallel (~> 1.10)
|
162
|
-
parser (>= 2.7.
|
162
|
+
parser (>= 2.7.1.1)
|
163
163
|
rainbow (>= 2.2.2, < 4.0)
|
164
|
+
regexp_parser (>= 1.7)
|
164
165
|
rexml
|
166
|
+
rubocop-ast (>= 0.3.0, < 1.0)
|
165
167
|
ruby-progressbar (~> 1.7)
|
166
|
-
unicode-display_width (>= 1.4.0, <
|
167
|
-
rubocop-
|
168
|
-
|
168
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
169
|
+
rubocop-ast (0.8.0)
|
170
|
+
parser (>= 2.7.1.5)
|
171
|
+
rubocop-rails (2.9.1)
|
172
|
+
activesupport (>= 4.2.0)
|
169
173
|
rack (>= 1.1)
|
170
|
-
rubocop (>= 0.
|
171
|
-
ruby-progressbar (1.
|
174
|
+
rubocop (>= 0.90.0, < 2.0)
|
175
|
+
ruby-progressbar (1.11.0)
|
172
176
|
shellany (0.0.1)
|
177
|
+
sqlite3 (1.4.2)
|
173
178
|
thor (1.0.1)
|
174
179
|
thread_safe (0.3.6)
|
175
180
|
timecop (0.9.1)
|
176
|
-
tzinfo (1.2.
|
181
|
+
tzinfo (1.2.9)
|
177
182
|
thread_safe (~> 0.1)
|
178
|
-
unicode-display_width (1.
|
183
|
+
unicode-display_width (1.7.0)
|
179
184
|
with_advisory_lock (3.2.0)
|
180
185
|
activerecord (>= 3.2)
|
181
|
-
zeitwerk (2.
|
186
|
+
zeitwerk (2.4.2)
|
182
187
|
|
183
188
|
PLATFORMS
|
184
189
|
ruby
|
185
190
|
|
186
191
|
DEPENDENCIES
|
187
192
|
actionpack (>= 4.0)
|
188
|
-
active_interaction (~> 3.0)
|
189
193
|
appraisal
|
190
194
|
bundler (~> 2.0)
|
191
195
|
climate_control
|
@@ -201,6 +205,7 @@ DEPENDENCIES
|
|
201
205
|
rspec (>= 2.12.0, < 4.0)
|
202
206
|
rspec-instrumentation-matcher
|
203
207
|
rspec-rails
|
208
|
+
sqlite3
|
204
209
|
timecop
|
205
210
|
|
206
211
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -104,6 +104,29 @@ class ApiAreaController < ApplicationController
|
|
104
104
|
...
|
105
105
|
```
|
106
106
|
|
107
|
+
### Types
|
108
|
+
|
109
|
+
In initializer:
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
require 'roqua/type'
|
113
|
+
```
|
114
|
+
|
115
|
+
In models:
|
116
|
+
|
117
|
+
```ruby
|
118
|
+
# strip whitespace and nil if blank.
|
119
|
+
attribute :firstname, :stripped_string
|
120
|
+
# strip, but don't nil if blank.
|
121
|
+
attribute :firstname, :stripped_string, allow_empty: true
|
122
|
+
```
|
123
|
+
|
124
|
+
#### option 2
|
125
|
+
|
126
|
+
`require 'roqua/type/stripped_string'`
|
127
|
+
|
128
|
+
`attribute :firstname, Roqua::Type::StrippedString.new(allow_empty: true)`
|
129
|
+
|
107
130
|
# Delayed Job activity monitoring
|
108
131
|
|
109
132
|
To add monitoring of whether Delayed Job keeps picking up jobs or checking for new jobs, add the following line to an initializer:
|
data/gemfiles/rails52.gemfile
CHANGED
@@ -3,14 +3,14 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "appraisal"
|
6
|
-
gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git"
|
6
|
+
gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git", ref: "9662550"
|
7
|
+
gem "active_interaction", "~> 3.0"
|
7
8
|
gem "activesupport", "~> 5.2.0"
|
8
|
-
gem "sqlite3", "~> 1.4"
|
9
9
|
gem "appsignal", "~> 2.9.8"
|
10
10
|
|
11
11
|
group :test do
|
12
|
+
gem "sqlite3"
|
12
13
|
gem "actionpack", ">= 4.0"
|
13
|
-
gem "active_interaction", "~> 3.0"
|
14
14
|
gem "climate_control"
|
15
15
|
gem "combustion", "~> 1.1.1"
|
16
16
|
gem "fakefs", require: "fakefs/safe"
|
data/gemfiles/rails60.gemfile
CHANGED
@@ -3,14 +3,13 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "appraisal"
|
6
|
-
gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git"
|
6
|
+
gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git", ref: "9662550"
|
7
7
|
gem "activesupport", "~> 6.0.0"
|
8
|
-
gem "sqlite3", "~> 1.4"
|
9
8
|
gem "appsignal", "~> 2.10.6"
|
10
9
|
|
11
10
|
group :test do
|
11
|
+
gem "sqlite3"
|
12
12
|
gem "actionpack", ">= 4.0"
|
13
|
-
gem "active_interaction", "~> 3.0"
|
14
13
|
gem "climate_control"
|
15
14
|
gem "combustion", "~> 1.1.1"
|
16
15
|
gem "fakefs", require: "fakefs/safe"
|
@@ -3,13 +3,13 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "appraisal"
|
6
|
-
gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git"
|
7
|
-
gem "activesupport", "~>
|
8
|
-
gem "
|
6
|
+
gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git", ref: "9662550"
|
7
|
+
gem "activesupport", "~> 6.1.0"
|
8
|
+
gem "appsignal", "~> 3.0.0"
|
9
9
|
|
10
10
|
group :test do
|
11
|
+
gem "sqlite3"
|
11
12
|
gem "actionpack", ">= 4.0"
|
12
|
-
gem "active_interaction", "~> 3.0"
|
13
13
|
gem "climate_control"
|
14
14
|
gem "combustion", "~> 1.1.1"
|
15
15
|
gem "fakefs", require: "fakefs/safe"
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# allow datetimes to be given as unix times for activeinteractions
|
2
2
|
module RoquaDateTimeAsUnixFilterExtension
|
3
|
-
def cast(value, interaction)
|
3
|
+
def cast(value, interaction, **options)
|
4
4
|
case value
|
5
5
|
when Numeric, /^[0-9]+$/
|
6
6
|
Time.at(value.to_i).to_datetime
|
7
7
|
when ''
|
8
|
-
super(nil, interaction)
|
8
|
+
super(nil, interaction, **options)
|
9
9
|
else
|
10
10
|
super
|
11
11
|
end
|
@@ -15,12 +15,12 @@ ActiveInteraction::DateTimeFilter.include RoquaDateTimeAsUnixFilterExtension
|
|
15
15
|
|
16
16
|
# allow datetimes to be given as unix times as string
|
17
17
|
module RoquaTimeAsUnixFilterExtension
|
18
|
-
def cast(value, interaction)
|
18
|
+
def cast(value, interaction, **options)
|
19
19
|
case value
|
20
20
|
when /^[0-9]+$/
|
21
21
|
Time.at(value.to_i)
|
22
22
|
when ''
|
23
|
-
super(nil, interaction)
|
23
|
+
super(nil, interaction, **options)
|
24
24
|
else
|
25
25
|
super
|
26
26
|
end
|
@@ -29,7 +29,10 @@ class Roqua::Scheduling::Scheduler
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def advisory_lock_name
|
32
|
-
|
32
|
+
db_name = ActiveRecord::Base.respond_to?(:connection_db_config) \
|
33
|
+
? ActiveRecord::Base.connection_db_config.database
|
34
|
+
: ActiveRecord::Base.connection_config[:database]
|
35
|
+
"#{db_name}_cron_lock"
|
33
36
|
end
|
34
37
|
|
35
38
|
private
|
data/lib/roqua/support/errors.rb
CHANGED
@@ -82,7 +82,10 @@ module Roqua
|
|
82
82
|
current_transaction.set_tags(labels)
|
83
83
|
current_transaction.add_exception(exception)
|
84
84
|
else
|
85
|
-
Appsignal.send_error exception
|
85
|
+
Appsignal.send_error exception do |transaction|
|
86
|
+
transaction.set_tags labels
|
87
|
+
transaction.set_namespace namespace
|
88
|
+
end
|
86
89
|
end
|
87
90
|
end
|
88
91
|
end
|
data/lib/roqua/type.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Strips whitespace and make nil when string becomes empty.
|
4
|
+
module Roqua
|
5
|
+
module Type
|
6
|
+
class StrippedString < ActiveModel::Type::ImmutableString
|
7
|
+
# taken from strip_attributes gem
|
8
|
+
# Unicode invisible and whitespace characters. The POSIX character class
|
9
|
+
# [:space:] corresponds to the Unicode class Z ("separator"). We also
|
10
|
+
# include the following characters from Unicode class C ("control"), which
|
11
|
+
# are spaces or invisible characters that make no sense at the start or end
|
12
|
+
# of a string:
|
13
|
+
# U+180E MONGOLIAN VOWEL SEPARATOR
|
14
|
+
# U+200B ZERO WIDTH SPACE
|
15
|
+
# U+200C ZERO WIDTH NON-JOINER
|
16
|
+
# U+200D ZERO WIDTH JOINER
|
17
|
+
# U+2060 WORD JOINER
|
18
|
+
# U+FEFF ZERO WIDTH NO-BREAK SPACE
|
19
|
+
MULTIBYTE_WHITE = "\u180E\u200B\u200C\u200D\u2060\uFEFF"
|
20
|
+
MULTIBYTE_SPACE = /[[:space:]#{MULTIBYTE_WHITE}]/.freeze
|
21
|
+
|
22
|
+
def initialize(allow_empty: false)
|
23
|
+
super()
|
24
|
+
@allow_empty = allow_empty
|
25
|
+
end
|
26
|
+
|
27
|
+
def cast(value)
|
28
|
+
return unless value
|
29
|
+
value = super(value).gsub(/\A#{MULTIBYTE_SPACE}+|#{MULTIBYTE_SPACE}+\z/, "").freeze
|
30
|
+
value.blank? && !@allow_empty ? nil : value
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -6,7 +6,7 @@ class SubsetValidator < ActiveModel::EachValidator
|
|
6
6
|
def validate_each(record, attribute, value)
|
7
7
|
return unless value
|
8
8
|
unless value.all? { |element| options.fetch(:of).include? element }
|
9
|
-
record.errors
|
9
|
+
record.errors.add attribute, (options[:message] || I18n.t('errors.messages.subset'))
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
data/roqua-support.gemspec
CHANGED
@@ -18,12 +18,12 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.required_ruby_version = '>= 2.
|
22
|
-
gem.add_dependency 'active_interaction', '
|
23
|
-
gem.add_dependency 'activesupport', '>= 5.
|
21
|
+
gem.required_ruby_version = '>= 2.7'
|
22
|
+
gem.add_dependency 'active_interaction', '>= 3.0', '< 5.0'
|
23
|
+
gem.add_dependency 'activesupport', '>= 5.2', '< 6.2'
|
24
24
|
gem.add_dependency 'naught', '~> 1.0'
|
25
25
|
gem.add_dependency 'with_advisory_lock', '~> 3.2'
|
26
|
-
gem.add_dependency 'appsignal', '>= 2.9', '<
|
26
|
+
gem.add_dependency 'appsignal', '>= 2.9', '< 3.1'
|
27
27
|
|
28
28
|
gem.add_development_dependency 'bundler', '~> 2.0'
|
29
29
|
gem.add_development_dependency 'delayed_job_active_record'
|
@@ -51,7 +51,7 @@ describe Roqua::Scheduling::Scheduler do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'generates a database specific advisory lock name' do
|
54
|
-
expect(ActiveRecord::Base.connection_config[:database]).to eql(':memory:')
|
54
|
+
# expect(ActiveRecord::Base.connection_config[:database]).to eql(':memory:')
|
55
55
|
expect(subject.advisory_lock_name).to eql ':memory:_cron_lock'
|
56
56
|
end
|
57
57
|
|
@@ -106,16 +106,21 @@ describe 'Error reporting' do
|
|
106
106
|
end
|
107
107
|
|
108
108
|
it 'defaults to a background job' do
|
109
|
-
|
109
|
+
transaction = Appsignal::Transaction.new(SecureRandom.uuid, Appsignal::Transaction::FRONTEND, nil)
|
110
|
+
expect(Appsignal).to receive(:send_error).with(exception).and_yield(transaction)
|
110
111
|
Roqua::Support::Errors.report exception
|
112
|
+
expect(transaction.namespace).to eq Appsignal::Transaction::BACKGROUND_JOB
|
111
113
|
end
|
112
114
|
|
113
115
|
it 'it will send an error under the provided category' do
|
116
|
+
transaction = Appsignal::Transaction.new(SecureRandom.uuid, Appsignal::Transaction::FRONTEND, nil)
|
114
117
|
expect(Appsignal)
|
115
118
|
.to receive(:send_error)
|
116
|
-
.with(exception
|
119
|
+
.with(exception).and_yield(transaction)
|
117
120
|
|
118
121
|
Roqua::Support::Errors.report exception, a: 'b', namespace: :web
|
122
|
+
expect(transaction.namespace).to eq Appsignal::Transaction::HTTP_REQUEST
|
123
|
+
expect(transaction.tags).to eq a: 'b'
|
119
124
|
end
|
120
125
|
|
121
126
|
describe 'when a current transaction is present' do
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'roqua/type/stripped_string'
|
5
|
+
|
6
|
+
RSpec.describe Roqua::Type::StrippedString do
|
7
|
+
let(:cls) do
|
8
|
+
Class.new(ActiveRecord::Base) do
|
9
|
+
self.table_name = 'delayed_jobs'
|
10
|
+
|
11
|
+
attribute :locked_by, Roqua::Type::StrippedString.new
|
12
|
+
attribute :queue, Roqua::Type::StrippedString.new(allow_empty: true)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it "strips whitespace from outside and not inside" do
|
17
|
+
expect(described_class.new.cast(" some name \n \t \u180E\u200B\u200C\u200D\u2060\uFEFF ")).to eq "some name"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "nils empty values by default" do
|
21
|
+
expect(described_class.new.cast(" \n \t ")).to eq nil
|
22
|
+
end
|
23
|
+
|
24
|
+
it "keeps value empty if allow_empty is true" do
|
25
|
+
expect(described_class.new(allow_empty: true).cast(" \n \t ")).to eq ""
|
26
|
+
end
|
27
|
+
|
28
|
+
it "works on active_record" do
|
29
|
+
instance = cls.new(locked_by: " \n \t ", queue: " \n \t ", cron: " \n \t ")
|
30
|
+
expect(instance.locked_by).to be_nil
|
31
|
+
expect(instance.queue).to eq ""
|
32
|
+
expect(instance.cron).to eq " \n \t "
|
33
|
+
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,49 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roqua-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marten Veldthuis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_interaction
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '3.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: activesupport
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
39
|
+
version: '5.2'
|
34
40
|
- - "<"
|
35
41
|
- !ruby/object:Gem::Version
|
36
|
-
version: '6.
|
42
|
+
version: '6.2'
|
37
43
|
type: :runtime
|
38
44
|
prerelease: false
|
39
45
|
version_requirements: !ruby/object:Gem::Requirement
|
40
46
|
requirements:
|
41
47
|
- - ">="
|
42
48
|
- !ruby/object:Gem::Version
|
43
|
-
version: '5.
|
49
|
+
version: '5.2'
|
44
50
|
- - "<"
|
45
51
|
- !ruby/object:Gem::Version
|
46
|
-
version: '6.
|
52
|
+
version: '6.2'
|
47
53
|
- !ruby/object:Gem::Dependency
|
48
54
|
name: naught
|
49
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +87,7 @@ dependencies:
|
|
81
87
|
version: '2.9'
|
82
88
|
- - "<"
|
83
89
|
- !ruby/object:Gem::Version
|
84
|
-
version: '
|
90
|
+
version: '3.1'
|
85
91
|
type: :runtime
|
86
92
|
prerelease: false
|
87
93
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -91,7 +97,7 @@ dependencies:
|
|
91
97
|
version: '2.9'
|
92
98
|
- - "<"
|
93
99
|
- !ruby/object:Gem::Version
|
94
|
-
version: '
|
100
|
+
version: '3.1'
|
95
101
|
- !ruby/object:Gem::Dependency
|
96
102
|
name: bundler
|
97
103
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,9 +194,9 @@ files:
|
|
188
194
|
- README.md
|
189
195
|
- Rakefile
|
190
196
|
- circle.yml
|
191
|
-
- gemfiles/rails51.gemfile
|
192
197
|
- gemfiles/rails52.gemfile
|
193
198
|
- gemfiles/rails60.gemfile
|
199
|
+
- gemfiles/rails61.gemfile
|
194
200
|
- lib/roqua-support.rb
|
195
201
|
- lib/roqua-support/railtie.rb
|
196
202
|
- lib/roqua-support/version.rb
|
@@ -224,6 +230,8 @@ files:
|
|
224
230
|
- lib/roqua/support/request_logger.rb
|
225
231
|
- lib/roqua/support/stats.rb
|
226
232
|
- lib/roqua/support/stats/hosted_graphite_backend.rb
|
233
|
+
- lib/roqua/type.rb
|
234
|
+
- lib/roqua/type/stripped_string.rb
|
227
235
|
- lib/roqua/validators/subset_validator.rb
|
228
236
|
- roqua-support.gemspec
|
229
237
|
- spec/internal/config/balancer_state
|
@@ -250,6 +258,7 @@ files:
|
|
250
258
|
- spec/roqua/support/request_logger_spec.rb
|
251
259
|
- spec/roqua/support/stats_spec.rb
|
252
260
|
- spec/roqua/support_spec.rb
|
261
|
+
- spec/roqua/type/stripped_string_spec.rb
|
253
262
|
- spec/roqua/validators/subset_validator_spec.rb
|
254
263
|
- spec/spec_helper.rb
|
255
264
|
- styleguide/ruby/rubocop.yml
|
@@ -265,7 +274,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
265
274
|
requirements:
|
266
275
|
- - ">="
|
267
276
|
- !ruby/object:Gem::Version
|
268
|
-
version: '2.
|
277
|
+
version: '2.7'
|
269
278
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
270
279
|
requirements:
|
271
280
|
- - ">="
|
@@ -301,5 +310,6 @@ test_files:
|
|
301
310
|
- spec/roqua/support/request_logger_spec.rb
|
302
311
|
- spec/roqua/support/stats_spec.rb
|
303
312
|
- spec/roqua/support_spec.rb
|
313
|
+
- spec/roqua/type/stripped_string_spec.rb
|
304
314
|
- spec/roqua/validators/subset_validator_spec.rb
|
305
315
|
- spec/spec_helper.rb
|