roqua-support 0.3.3 → 0.4.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: 24fe6b6328c7e8a57bbd3de088117e34d320f9ddc6aaa4954334dcfe5a934d35
4
- data.tar.gz: 6429dbcedaea67f7b8581afca9181fb6854fd467f01ce01d403cf55a8c9b19b2
3
+ metadata.gz: 0104ee377feaa85014f2a233e86c618a08de92e7b55cd273fe7832f491f070b4
4
+ data.tar.gz: 7c04430ab277f7c69cb0d1cf8d54a0901cb127460b2b68e3b91ad3c01b171204
5
5
  SHA512:
6
- metadata.gz: 308371f74905c87008b9a6d91989614fa18d058b75ba3c55f934d17ac68947d0fa0fe1d582bf9b9a67cc2da595d83e446505a10bbd9da285919808c9a729c645
7
- data.tar.gz: 9a2ae0fef0524d771e5306045db5fb4d2172a6e48647355c8a271d1216d39ededf08e89824c123bf14dd561c29898c7a18338efc897ba3143860098dc0a56ea8
6
+ metadata.gz: da8540ad9f35f3738485ec3f58b28ba14c2a330ae6ae2cd4d1bfefbe46206f0c7c8b842053829dcf4e668d57c03890137f2536c559d805d51ba1c04755daf58c
7
+ data.tar.gz: 01a31a8402b496e30298ceda86e2ebcbf06eb09d7453e9a56a681f159335eab03d3436487e4bb138afbe027990a1c4747acf0c3d06756a4d3ae56749144635da
data/.gitlab-ci.yml CHANGED
@@ -2,63 +2,31 @@ variables:
2
2
  RAILS_ENV: "test"
3
3
 
4
4
  before_script:
5
+ - if [ -x "$(command -v apk)" ]; then apk add sqlite-dev; fi
5
6
  - export BUNDLE_PATH=$CI_PROJECT_DIR/.gems
6
7
  - bundle --jobs 2 --retry 3
7
- - bundle exec appraisal
8
- - bundle --jobs 2 --retry 3
8
+ - bundle exec appraisal install
9
9
 
10
- .ruby_23: &ruby_23
11
- image: registry.roqua.nl/roqua/roqua-build-images:ruby-2.3-rails-base-test
12
- cache:
13
- key: ruby_23
14
- paths:
15
- - .gems
16
10
 
17
- .ruby_24: &ruby_24
18
- image: registry.roqua.nl/roqua/roqua-build-images:ruby-2.4-rails-base-test
11
+ .ruby_27: &ruby_27
12
+ image: registry.roqua.nl/roqua/docker-base-images:ruby-2.7-builder
19
13
  cache:
20
- key: ruby_24
14
+ key: ruby_27
21
15
  paths:
22
16
  - .gems
23
17
 
24
- .ruby_25: &ruby_25
25
- image: registry.roqua.nl/roqua/docker-base-images:ruby-2.5
26
- cache:
27
- key: ruby_25
28
- paths:
29
- - .gems
30
-
31
- rails_50_ruby_24:
32
- <<: *ruby_24
33
- script:
34
- - bundle exec appraisal rails50 bundle exec rspec
35
-
36
- rails_50_ruby_25:
37
- <<: *ruby_25
38
- script:
39
- - bundle exec appraisal rails50 bundle exec rspec
40
18
 
41
- rails_51_ruby_24:
42
- <<: *ruby_24
43
- script:
44
- - bundle exec appraisal rails51 bundle exec rspec
45
-
46
- rails_51_ruby_25:
47
- <<: *ruby_25
48
- script:
49
- - bundle exec appraisal rails51 bundle exec rspec
50
-
51
- rails_52_ruby_24:
52
- <<: *ruby_24
19
+ rails_52_ruby_27:
20
+ <<: *ruby_27
53
21
  script:
54
22
  - bundle exec appraisal rails52 bundle exec rspec
55
23
 
56
- rails_52_ruby_25:
57
- <<: *ruby_25
24
+ rails_60_ruby_27:
25
+ <<: *ruby_27
58
26
  script:
59
- - bundle exec appraisal rails52 bundle exec rspec
27
+ - bundle exec appraisal rails60 bundle exec rspec
60
28
 
61
- rails_60_ruby_25:
62
- <<: *ruby_25
29
+ rails_61_ruby_27:
30
+ <<: *ruby_27
63
31
  script:
64
- - bundle exec appraisal rails60 bundle exec rspec
32
+ - bundle exec appraisal rails61 bundle exec rspec
data/Appraisals CHANGED
@@ -1,26 +1,15 @@
1
- appraise "rails42" do
2
- gem "activesupport", "~> 4.2.10"
3
- gem 'sqlite3', '~> 1.3.6'
4
- end
5
-
6
- appraise "rails50" do
7
- gem "activesupport", "~> 5.0.0"
8
- gem 'sqlite3', '~> 1.3.6'
9
- end
10
-
11
- appraise "rails51" do
12
- gem "activesupport", "~> 5.1.0"
13
- gem 'sqlite3', '~> 1.3.6'
14
- end
15
-
16
1
  appraise "rails52" do
2
+ gem "active_interaction", "~> 3.0"
17
3
  gem "activesupport", "~> 5.2.0"
18
- gem 'sqlite3', '~> 1.3.6'
4
+ gem 'appsignal', '~> 2.9.8' # test each minor versions we support
5
+ end
6
+
7
+ appraise "rails60" do
8
+ gem "activesupport", "~> 6.0.0"
9
+ gem 'appsignal', '~> 2.10.6'
19
10
  end
20
11
 
21
- if RUBY_VERSION.to_f >= 2.5
22
- appraise "rails60" do
23
- gem "activesupport", "~> 6.0.0"
24
- gem 'sqlite3', '~> 1.4'
25
- end
12
+ appraise "rails61" do
13
+ gem "activesupport", "~> 6.1.0"
14
+ gem 'appsignal', '~> 3.0.0'
26
15
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## 0.4.1
2
+
3
+ * Add timezone to logging timestamps. Use milliseconds instead of microseconds precision.
4
+
5
+ ## 0.4.0
6
+
7
+ * Remove support for ruby 2.5 and 2.6
8
+ * Add stripped_string type (attributes api)
9
+ * Add support for appsignal v3
10
+ * Add support for active_interaction v4
11
+
12
+ ## 0.3.5
13
+
14
+ * Update AppSignal gauge for every minute the probe runs
15
+
16
+ ## 0.3.4
17
+
18
+ * gemspec and tests: Removed rails 4.2 and 5.0, remove ruby 2.3 and 2.4, added ruby 2.6, allow appsignal 2.10
19
+
1
20
  ## 0.3.3
2
21
 
3
22
  * Added support for hl7 namespace when reporting errors
data/Gemfile CHANGED
@@ -4,12 +4,12 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'appraisal'
7
- gem 'roqua_styleguide', git: 'https://gitlab.roqua.nl/roqua/styleguide.git'
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
- gem 'appsignal', '~> 2.9.8'
13
13
  gem 'climate_control' # For ENV modification in specs
14
14
  gem 'combustion', '~> 1.1.1'
15
15
  gem 'fakefs', require: 'fakefs/safe'
data/Gemfile.lock CHANGED
@@ -1,79 +1,82 @@
1
1
  GIT
2
2
  remote: https://gitlab.roqua.nl/roqua/styleguide.git
3
- revision: e1fbbb611484e295719ed91c4eef889753ac8d8f
3
+ revision: 9662550201987db20c03e300eddb34d8ad035613
4
+ ref: 9662550
4
5
  specs:
5
- roqua_styleguide (0.0.6)
6
- rubocop (~> 0.50.0)
6
+ roqua_styleguide (0.0.8)
7
+ rubocop (~> 0.90.0)
8
+ rubocop-rails
7
9
 
8
10
  PATH
9
11
  remote: .
10
12
  specs:
11
- roqua-support (0.3.3)
12
- active_interaction (~> 3.0)
13
- activesupport (>= 3.2, < 6.1)
14
- appsignal (~> 2.9.8)
13
+ roqua-support (0.4.1)
14
+ active_interaction (>= 3.0, < 5.0)
15
+ activesupport (>= 5.2, < 6.2)
16
+ appsignal (>= 2.9, < 3.1)
15
17
  naught (~> 1.0)
16
18
  with_advisory_lock (~> 3.2)
17
19
 
18
20
  GEM
19
21
  remote: https://rubygems.org/
20
22
  specs:
21
- actionpack (5.0.1)
22
- actionview (= 5.0.1)
23
- activesupport (= 5.0.1)
24
- rack (~> 2.0)
25
- rack-test (~> 0.6.3)
23
+ actionpack (6.0.2.2)
24
+ actionview (= 6.0.2.2)
25
+ activesupport (= 6.0.2.2)
26
+ rack (~> 2.0, >= 2.0.8)
27
+ rack-test (>= 0.6.3)
26
28
  rails-dom-testing (~> 2.0)
27
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
- actionview (5.0.1)
29
- activesupport (= 5.0.1)
29
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
30
+ actionview (6.0.2.2)
31
+ activesupport (= 6.0.2.2)
30
32
  builder (~> 3.1)
31
- erubis (~> 2.7.0)
33
+ erubi (~> 1.4)
32
34
  rails-dom-testing (~> 2.0)
33
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
34
- active_interaction (3.4.0)
35
- activemodel (>= 4, < 6)
36
- activemodel (5.0.1)
37
- activesupport (= 5.0.1)
38
- activerecord (5.0.1)
39
- activemodel (= 5.0.1)
40
- activesupport (= 5.0.1)
41
- arel (~> 7.0)
42
- activesupport (5.0.1)
35
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
36
+ active_interaction (4.0.5)
37
+ activemodel (>= 5, < 7)
38
+ activesupport (>= 5, < 7)
39
+ activemodel (6.0.2.2)
40
+ activesupport (= 6.0.2.2)
41
+ activerecord (6.0.2.2)
42
+ activemodel (= 6.0.2.2)
43
+ activesupport (= 6.0.2.2)
44
+ activesupport (6.0.2.2)
43
45
  concurrent-ruby (~> 1.0, >= 1.0.2)
44
- i18n (~> 0.7)
46
+ i18n (>= 0.7, < 2)
45
47
  minitest (~> 5.1)
46
48
  tzinfo (~> 1.1)
47
- appraisal (2.1.0)
49
+ zeitwerk (~> 2.2)
50
+ appraisal (2.2.0)
48
51
  bundler
49
52
  rake
50
53
  thor (>= 0.14.0)
51
- appsignal (2.9.8)
54
+ appsignal (3.0.13)
52
55
  rack
53
- arel (7.1.4)
54
- ast (2.3.0)
55
- builder (3.2.3)
56
+ ast (2.4.2)
57
+ builder (3.2.4)
56
58
  climate_control (0.2.0)
57
- coderay (1.1.1)
58
- combustion (1.1.1)
59
+ coderay (1.1.2)
60
+ combustion (1.1.2)
59
61
  activesupport (>= 3.0.0)
60
62
  railties (>= 3.0.0)
61
63
  thor (>= 0.14.6)
62
- concurrent-ruby (1.0.4)
63
- delayed_job (4.1.4)
64
- activesupport (>= 3.0, < 5.2)
65
- delayed_job_active_record (4.1.2)
66
- activerecord (>= 3.0, < 5.2)
64
+ concurrent-ruby (1.1.8)
65
+ crass (1.0.6)
66
+ delayed_job (4.1.8)
67
+ activesupport (>= 3.0, < 6.1)
68
+ delayed_job_active_record (4.1.4)
69
+ activerecord (>= 3.0, < 6.1)
67
70
  delayed_job (>= 3.0, < 5)
68
71
  diff-lcs (1.3)
69
- erubis (2.7.0)
70
- fakefs (0.15.0)
71
- ffi (1.9.17)
72
+ erubi (1.9.0)
73
+ fakefs (1.2.2)
74
+ ffi (1.12.2)
72
75
  formatador (0.2.5)
73
- guard (2.14.0)
76
+ guard (2.16.2)
74
77
  formatador (>= 0.2.4)
75
78
  listen (>= 2.7, < 4.0)
76
- lumberjack (~> 1.0)
79
+ lumberjack (>= 1.0.12, < 2.0)
77
80
  nenv (~> 0.1)
78
81
  notiffany (~> 0.0)
79
82
  pry (>= 0.9.12)
@@ -82,106 +85,113 @@ GEM
82
85
  guard-rspec (4.2.10)
83
86
  guard (~> 2.1)
84
87
  rspec (>= 2.14, < 4.0)
85
- i18n (0.7.0)
86
- listen (3.1.5)
87
- rb-fsevent (~> 0.9, >= 0.9.4)
88
- rb-inotify (~> 0.9, >= 0.9.7)
89
- ruby_dep (~> 1.2)
90
- loofah (2.0.3)
88
+ i18n (1.8.10)
89
+ concurrent-ruby (~> 1.0)
90
+ listen (3.2.1)
91
+ rb-fsevent (~> 0.10, >= 0.10.3)
92
+ rb-inotify (~> 0.9, >= 0.9.10)
93
+ loofah (2.5.0)
94
+ crass (~> 1.0.2)
91
95
  nokogiri (>= 1.5.9)
92
- lumberjack (1.0.11)
93
- method_source (0.8.2)
94
- mini_portile2 (2.1.0)
95
- minitest (5.10.1)
96
+ lumberjack (1.2.4)
97
+ method_source (1.0.0)
98
+ mini_portile2 (2.4.0)
99
+ minitest (5.14.4)
96
100
  naught (1.1.0)
97
101
  nenv (0.3.0)
98
- nokogiri (1.7.0.1)
99
- mini_portile2 (~> 2.1.0)
100
- notiffany (0.1.1)
102
+ nokogiri (1.10.9)
103
+ mini_portile2 (~> 2.4.0)
104
+ notiffany (0.1.3)
101
105
  nenv (~> 0.1)
102
106
  shellany (~> 0.0)
103
- parallel (1.12.0)
104
- parser (2.4.0.0)
105
- ast (~> 2.2)
106
- powerpack (0.1.1)
107
- pry (0.10.4)
108
- coderay (~> 1.1.0)
109
- method_source (~> 0.8.1)
110
- slop (~> 3.4)
111
- rack (2.0.7)
112
- rack-test (0.6.3)
113
- rack (>= 1.0)
114
- rails-dom-testing (2.0.2)
115
- activesupport (>= 4.2.0, < 6.0)
116
- nokogiri (~> 1.6)
117
- rails-html-sanitizer (1.0.3)
118
- loofah (~> 2.0)
119
- railties (5.0.1)
120
- actionpack (= 5.0.1)
121
- activesupport (= 5.0.1)
107
+ parallel (1.20.1)
108
+ parser (3.0.0.0)
109
+ ast (~> 2.4.1)
110
+ pry (0.13.1)
111
+ coderay (~> 1.1)
112
+ method_source (~> 1.0)
113
+ rack (2.2.3)
114
+ rack-test (1.1.0)
115
+ rack (>= 1.0, < 3)
116
+ rails-dom-testing (2.0.3)
117
+ activesupport (>= 4.2.0)
118
+ nokogiri (>= 1.6)
119
+ rails-html-sanitizer (1.3.0)
120
+ loofah (~> 2.3)
121
+ railties (6.0.2.2)
122
+ actionpack (= 6.0.2.2)
123
+ activesupport (= 6.0.2.2)
122
124
  method_source
123
125
  rake (>= 0.8.7)
124
- thor (>= 0.18.1, < 2.0)
125
- rainbow (2.2.2)
126
- rake
127
- rake (12.1.0)
128
- rb-fsevent (0.9.8)
129
- rb-inotify (0.9.7)
130
- ffi (>= 0.5.0)
131
- responders (2.3.0)
132
- railties (>= 4.2.0, < 5.1)
133
- rspec (3.5.0)
134
- rspec-core (~> 3.5.0)
135
- rspec-expectations (~> 3.5.0)
136
- rspec-mocks (~> 3.5.0)
137
- rspec-core (3.5.4)
138
- rspec-support (~> 3.5.0)
139
- rspec-expectations (3.5.0)
126
+ thor (>= 0.20.3, < 2.0)
127
+ rainbow (3.0.0)
128
+ rake (13.0.1)
129
+ rb-fsevent (0.10.4)
130
+ rb-inotify (0.10.1)
131
+ ffi (~> 1.0)
132
+ regexp_parser (2.1.1)
133
+ responders (3.0.0)
134
+ actionpack (>= 5.0)
135
+ railties (>= 5.0)
136
+ rexml (3.2.4)
137
+ rspec (3.9.0)
138
+ rspec-core (~> 3.9.0)
139
+ rspec-expectations (~> 3.9.0)
140
+ rspec-mocks (~> 3.9.0)
141
+ rspec-core (3.9.2)
142
+ rspec-support (~> 3.9.3)
143
+ rspec-expectations (3.9.1)
140
144
  diff-lcs (>= 1.2.0, < 2.0)
141
- rspec-support (~> 3.5.0)
142
- rspec-instrumentation-matcher (0.0.4)
145
+ rspec-support (~> 3.9.0)
146
+ rspec-instrumentation-matcher (0.0.9)
143
147
  activesupport
144
148
  rspec-expectations
145
- rspec-mocks (3.5.0)
149
+ rspec-mocks (3.9.1)
146
150
  diff-lcs (>= 1.2.0, < 2.0)
147
- rspec-support (~> 3.5.0)
148
- rspec-rails (3.5.2)
149
- actionpack (>= 3.0)
150
- activesupport (>= 3.0)
151
- railties (>= 3.0)
152
- rspec-core (~> 3.5.0)
153
- rspec-expectations (~> 3.5.0)
154
- rspec-mocks (~> 3.5.0)
155
- rspec-support (~> 3.5.0)
156
- rspec-support (3.5.0)
157
- rubocop (0.50.0)
151
+ rspec-support (~> 3.9.0)
152
+ rspec-rails (4.0.0)
153
+ actionpack (>= 4.2)
154
+ activesupport (>= 4.2)
155
+ railties (>= 4.2)
156
+ rspec-core (~> 3.9)
157
+ rspec-expectations (~> 3.9)
158
+ rspec-mocks (~> 3.9)
159
+ rspec-support (~> 3.9)
160
+ rspec-support (3.9.3)
161
+ rubocop (0.90.0)
158
162
  parallel (~> 1.10)
159
- parser (>= 2.3.3.1, < 3.0)
160
- powerpack (~> 0.1)
161
- rainbow (>= 2.2.2, < 3.0)
163
+ parser (>= 2.7.1.1)
164
+ rainbow (>= 2.2.2, < 4.0)
165
+ regexp_parser (>= 1.7)
166
+ rexml
167
+ rubocop-ast (>= 0.3.0, < 1.0)
162
168
  ruby-progressbar (~> 1.7)
163
- unicode-display_width (~> 1.0, >= 1.0.1)
164
- ruby-progressbar (1.8.3)
165
- ruby_dep (1.5.0)
169
+ unicode-display_width (>= 1.4.0, < 2.0)
170
+ rubocop-ast (0.8.0)
171
+ parser (>= 2.7.1.5)
172
+ rubocop-rails (2.9.1)
173
+ activesupport (>= 4.2.0)
174
+ rack (>= 1.1)
175
+ rubocop (>= 0.90.0, < 2.0)
176
+ ruby-progressbar (1.11.0)
166
177
  shellany (0.0.1)
167
- slop (3.6.0)
168
- thor (0.19.4)
169
- thread_safe (0.3.5)
178
+ sqlite3 (1.4.2)
179
+ thor (1.0.1)
180
+ thread_safe (0.3.6)
170
181
  timecop (0.9.1)
171
- tzinfo (1.2.2)
182
+ tzinfo (1.2.9)
172
183
  thread_safe (~> 0.1)
173
- unicode-display_width (1.3.0)
184
+ unicode-display_width (1.7.0)
174
185
  with_advisory_lock (3.2.0)
175
186
  activerecord (>= 3.2)
187
+ zeitwerk (2.4.2)
176
188
 
177
189
  PLATFORMS
178
190
  ruby
179
191
 
180
192
  DEPENDENCIES
181
193
  actionpack (>= 4.0)
182
- active_interaction (~> 3.0)
183
194
  appraisal
184
- appsignal (~> 2.9.8)
185
195
  bundler (~> 2.0)
186
196
  climate_control
187
197
  combustion (~> 1.1.1)
@@ -196,6 +206,7 @@ DEPENDENCIES
196
206
  rspec (>= 2.12.0, < 4.0)
197
207
  rspec-instrumentation-matcher
198
208
  rspec-rails
209
+ sqlite3
199
210
  timecop
200
211
 
201
212
  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:
@@ -3,17 +3,17 @@
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.3.6"
9
+ gem "appsignal", "~> 2.9.8"
9
10
 
10
11
  group :test do
12
+ gem "sqlite3"
11
13
  gem "actionpack", ">= 4.0"
12
- gem "active_interaction", "~> 3.0"
13
- gem "appsignal", "~> 2.9.8"
14
14
  gem "climate_control"
15
15
  gem "combustion", "~> 1.1.1"
16
- gem "fakefs", :require => "fakefs/safe"
16
+ gem "fakefs", require: "fakefs/safe"
17
17
  gem "guard-rspec", "~> 4.2.6"
18
18
  gem "responders"
19
19
  gem "rspec-instrumentation-matcher"
@@ -21,4 +21,4 @@ group :test do
21
21
  gem "pry"
22
22
  end
23
23
 
24
- gemspec :path => "../"
24
+ gemspec path: "../"
@@ -3,17 +3,16 @@
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"
8
+ gem "appsignal", "~> 2.10.6"
9
9
 
10
10
  group :test do
11
+ gem "sqlite3"
11
12
  gem "actionpack", ">= 4.0"
12
- gem "active_interaction", "~> 3.0"
13
- gem "appsignal", "~> 2.9.8"
14
13
  gem "climate_control"
15
14
  gem "combustion", "~> 1.1.1"
16
- gem "fakefs", :require => "fakefs/safe"
15
+ gem "fakefs", require: "fakefs/safe"
17
16
  gem "guard-rspec", "~> 4.2.6"
18
17
  gem "responders"
19
18
  gem "rspec-instrumentation-matcher"
@@ -21,4 +20,4 @@ group :test do
21
20
  gem "pry"
22
21
  end
23
22
 
24
- gemspec :path => "../"
23
+ gemspec path: "../"
@@ -3,17 +3,16 @@
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", "~> 5.0.0"
8
- gem "sqlite3", "~> 1.3.6"
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
- gem "appsignal", "~> 2.9.8"
14
13
  gem "climate_control"
15
14
  gem "combustion", "~> 1.1.1"
16
- gem "fakefs", :require => "fakefs/safe"
15
+ gem "fakefs", require: "fakefs/safe"
17
16
  gem "guard-rspec", "~> 4.2.6"
18
17
  gem "responders"
19
18
  gem "rspec-instrumentation-matcher"
@@ -21,4 +20,4 @@ group :test do
21
20
  gem "pry"
22
21
  end
23
22
 
24
- gemspec :path => "../"
23
+ gemspec path: "../"
@@ -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
@@ -7,6 +7,8 @@ class RoquaLoggingRailtie < Rails::Railtie
7
7
  def configure
8
8
  Roqua.logger = ActiveSupport::Logger.new(output_stream).tap do |logger|
9
9
  logger.formatter = Logger::Formatter.new
10
+ # Set the datetime_format to include timezone and use milliseconds instead of microseconds
11
+ logger.formatter.datetime_format = '%Y-%m-%dT%H:%M:%S.%L%z '
10
12
  end
11
13
 
12
14
  require 'roqua/support/request_logger'
@@ -11,6 +11,8 @@ class Roqua::Scheduling::Scheduler
11
11
  raise ex if Rails.env.test?
12
12
  end
13
13
  end
14
+
15
+ Appsignal.increment_counter("scheduler.completed", 1)
14
16
  end
15
17
  end
16
18
 
@@ -27,7 +29,10 @@ class Roqua::Scheduling::Scheduler
27
29
  end
28
30
 
29
31
  def advisory_lock_name
30
- "#{ActiveRecord::Base.connection_config[:database]}_cron_lock"
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"
31
36
  end
32
37
 
33
38
  private
@@ -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, labels, namespace
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
@@ -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
data/lib/roqua/type.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_model/type"
4
+
5
+ require_relative "./type/stripped_string"
6
+
7
+ ActiveRecord::Type.register(:stripped_string, Roqua::Type::StrippedString)
@@ -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[attribute] << (options[:message] || I18n.t('errors.messages.subset'))
9
+ record.errors.add attribute, (options[:message] || I18n.t('errors.messages.subset'))
10
10
  end
11
11
  end
12
12
  end
@@ -1,5 +1,5 @@
1
1
  module Roqua
2
2
  module Support
3
- VERSION = '0.3.3'.freeze
3
+ VERSION = '0.4.1'.freeze
4
4
  end
5
5
  end
@@ -18,11 +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.add_dependency 'active_interaction', '~> 3.0'
22
- gem.add_dependency 'activesupport', '>= 3.2', '< 6.1'
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'
23
24
  gem.add_dependency 'naught', '~> 1.0'
24
25
  gem.add_dependency 'with_advisory_lock', '~> 3.2'
25
- gem.add_dependency 'appsignal', '~> 2.9.8'
26
+ gem.add_dependency 'appsignal', '>= 2.9', '< 3.1'
26
27
 
27
28
  gem.add_development_dependency 'bundler', '~> 2.0'
28
29
  gem.add_development_dependency 'delayed_job_active_record'
@@ -27,6 +27,12 @@ Rspec.describe RoquaLoggingRailtie do
27
27
  ActiveSupport::Logger.logger_outputs_to?(Roqua.logger.logger, STDOUT)
28
28
  ).to be_truthy
29
29
  end
30
+
31
+ it 'logs using a datetimeformat including timezone' do
32
+ time = Time.zone.local(2021,10,10,16,13)
33
+ got = Roqua.logger.logger.formatter.call 'INFO', time, 'progname', '{}'
34
+ expect(got).to match(/I, \[2021-10-10T16:13:00.000\+0000 #\d+] INFO -- progname: {}/)
35
+ end
30
36
  end
31
37
 
32
38
  context 'when RAILS_LOG_TO_STDOUT_USING_ROQUA_LOGGER is blank' do
@@ -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
 
@@ -86,6 +86,7 @@ describe Roqua::Scheduling::Scheduler do
86
86
  end
87
87
 
88
88
  it 'counts task calls' do
89
+ expect(Appsignal).to receive(:increment_counter).with('scheduler.completed', 1)
89
90
  expect(Appsignal).to receive(:increment_counter).with('scheduler.run_task.completed', 1, task_name: 'hourly')
90
91
  subject.ping
91
92
  end
@@ -94,6 +94,7 @@ describe 'Error reporting' do
94
94
  let(:transaction) { double("transaction") }
95
95
 
96
96
  before do
97
+ Appsignal.config = Appsignal::Config.new(Dir.pwd, "test")
97
98
  allow(Appsignal).to receive(:active?).and_return(true)
98
99
  allow(Appsignal).to receive(:is_ignored_exception?).and_return(false)
99
100
  allow(Appsignal).to receive(:agent).and_return(agent)
@@ -105,16 +106,21 @@ describe 'Error reporting' do
105
106
  end
106
107
 
107
108
  it 'defaults to a background job' do
108
- expect(Appsignal).to receive(:send_error).with(exception, {}, Appsignal::Transaction::BACKGROUND_JOB)
109
+ transaction = Appsignal::Transaction.new(SecureRandom.uuid, Appsignal::Transaction::FRONTEND, nil)
110
+ expect(Appsignal).to receive(:send_error).with(exception).and_yield(transaction)
109
111
  Roqua::Support::Errors.report exception
112
+ expect(transaction.namespace).to eq Appsignal::Transaction::BACKGROUND_JOB
110
113
  end
111
114
 
112
115
  it 'it will send an error under the provided category' do
116
+ transaction = Appsignal::Transaction.new(SecureRandom.uuid, Appsignal::Transaction::FRONTEND, nil)
113
117
  expect(Appsignal)
114
118
  .to receive(:send_error)
115
- .with(exception, {a: 'b'}, Appsignal::Transaction::HTTP_REQUEST)
119
+ .with(exception).and_yield(transaction)
116
120
 
117
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'
118
124
  end
119
125
 
120
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.3.3
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-14 00:00:00.000000000 Z
11
+ date: 2021-10-20 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: '3.2'
39
+ version: '5.2'
34
40
  - - "<"
35
41
  - !ruby/object:Gem::Version
36
- version: '6.1'
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: '3.2'
49
+ version: '5.2'
44
50
  - - "<"
45
51
  - !ruby/object:Gem::Version
46
- version: '6.1'
52
+ version: '6.2'
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: naught
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -76,16 +82,22 @@ dependencies:
76
82
  name: appsignal
77
83
  requirement: !ruby/object:Gem::Requirement
78
84
  requirements:
79
- - - "~>"
85
+ - - ">="
80
86
  - !ruby/object:Gem::Version
81
- version: 2.9.8
87
+ version: '2.9'
88
+ - - "<"
89
+ - !ruby/object:Gem::Version
90
+ version: '3.1'
82
91
  type: :runtime
83
92
  prerelease: false
84
93
  version_requirements: !ruby/object:Gem::Requirement
85
94
  requirements:
86
- - - "~>"
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '2.9'
98
+ - - "<"
87
99
  - !ruby/object:Gem::Version
88
- version: 2.9.8
100
+ version: '3.1'
89
101
  - !ruby/object:Gem::Dependency
90
102
  name: bundler
91
103
  requirement: !ruby/object:Gem::Requirement
@@ -182,11 +194,9 @@ files:
182
194
  - README.md
183
195
  - Rakefile
184
196
  - circle.yml
185
- - gemfiles/rails42.gemfile
186
- - gemfiles/rails50.gemfile
187
- - gemfiles/rails51.gemfile
188
197
  - gemfiles/rails52.gemfile
189
198
  - gemfiles/rails60.gemfile
199
+ - gemfiles/rails61.gemfile
190
200
  - lib/roqua-support.rb
191
201
  - lib/roqua-support/railtie.rb
192
202
  - lib/roqua-support/version.rb
@@ -220,6 +230,8 @@ files:
220
230
  - lib/roqua/support/request_logger.rb
221
231
  - lib/roqua/support/stats.rb
222
232
  - lib/roqua/support/stats/hosted_graphite_backend.rb
233
+ - lib/roqua/type.rb
234
+ - lib/roqua/type/stripped_string.rb
223
235
  - lib/roqua/validators/subset_validator.rb
224
236
  - roqua-support.gemspec
225
237
  - spec/internal/config/balancer_state
@@ -246,6 +258,7 @@ files:
246
258
  - spec/roqua/support/request_logger_spec.rb
247
259
  - spec/roqua/support/stats_spec.rb
248
260
  - spec/roqua/support_spec.rb
261
+ - spec/roqua/type/stripped_string_spec.rb
249
262
  - spec/roqua/validators/subset_validator_spec.rb
250
263
  - spec/spec_helper.rb
251
264
  - styleguide/ruby/rubocop.yml
@@ -261,15 +274,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
261
274
  requirements:
262
275
  - - ">="
263
276
  - !ruby/object:Gem::Version
264
- version: '0'
277
+ version: '2.7'
265
278
  required_rubygems_version: !ruby/object:Gem::Requirement
266
279
  requirements:
267
280
  - - ">="
268
281
  - !ruby/object:Gem::Version
269
282
  version: '0'
270
283
  requirements: []
271
- rubyforge_project:
272
- rubygems_version: 2.7.6.2
284
+ rubygems_version: 3.1.4
273
285
  signing_key:
274
286
  specification_version: 4
275
287
  summary: Helper objects and proxies used by a lot of RoQua applications
@@ -298,5 +310,6 @@ test_files:
298
310
  - spec/roqua/support/request_logger_spec.rb
299
311
  - spec/roqua/support/stats_spec.rb
300
312
  - spec/roqua/support_spec.rb
313
+ - spec/roqua/type/stripped_string_spec.rb
301
314
  - spec/roqua/validators/subset_validator_spec.rb
302
315
  - spec/spec_helper.rb
@@ -1,24 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "appraisal"
6
- gem "roqua_styleguide", :git => "https://gitlab.roqua.nl/roqua/styleguide.git"
7
- gem "activesupport", "~> 4.2.10"
8
- gem "sqlite3", "~> 1.3.6"
9
-
10
- group :test do
11
- gem "actionpack", ">= 4.0"
12
- gem "active_interaction", "~> 3.0"
13
- gem "appsignal", "~> 2.9.8"
14
- gem "climate_control"
15
- gem "combustion", "~> 1.1.1"
16
- gem "fakefs", :require => "fakefs/safe"
17
- gem "guard-rspec", "~> 4.2.6"
18
- gem "responders"
19
- gem "rspec-instrumentation-matcher"
20
- gem "rspec-rails"
21
- gem "pry"
22
- end
23
-
24
- gemspec :path => "../"
@@ -1,24 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "appraisal"
6
- gem "roqua_styleguide", :git => "https://gitlab.roqua.nl/roqua/styleguide.git"
7
- gem "activesupport", "~> 5.1.0"
8
- gem "sqlite3", "~> 1.3.6"
9
-
10
- group :test do
11
- gem "actionpack", ">= 4.0"
12
- gem "active_interaction", "~> 3.0"
13
- gem "appsignal", "~> 2.9.8"
14
- gem "climate_control"
15
- gem "combustion", "~> 1.1.1"
16
- gem "fakefs", :require => "fakefs/safe"
17
- gem "guard-rspec", "~> 4.2.6"
18
- gem "responders"
19
- gem "rspec-instrumentation-matcher"
20
- gem "rspec-rails"
21
- gem "pry"
22
- end
23
-
24
- gemspec :path => "../"