nxt_support 0.5.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5be999049e08c616e9259357e3babdc21c8a56202e29463ffb35877d7b59156b
4
- data.tar.gz: a24d5abbc81b8a05104096251e7a1c5ef95fd4ef22378be9ad225e310848a417
3
+ metadata.gz: a56ccf2cd98ff0c8f6c75b4e54ff8e89b59aadfc86476ad1b0a91e9ce7c1fef5
4
+ data.tar.gz: d55f9511586bce10860b52f5188460346359c6e352056f1477dbb455595f0946
5
5
  SHA512:
6
- metadata.gz: 62f3c629491c73b7b9fe0ac85639d01671cd3845fa6250a5c5b980ca5ea2a3353bc17337f2a7dbf72904113761cf70d6b43864635a526eed6bb0f7eb859e997d
7
- data.tar.gz: 27ea42c5fa932be54cbc2b2e0cc1d5e1edd34176fe50e8fb8581507ce9429fba032dbba2aeda8806044f7471918eb8cc33744939a881ab4a6d409e7b2130ecb8
6
+ metadata.gz: ffd4890cb7f2fb0c78e5ae058aa7bfdbc22564dd33c31ae888700083a6b785e573b18defc021b646fe63c7936d73b0c7ba927143394e845e6dac17c53b2d5168
7
+ data.tar.gz: 20e6ddc394861312d81d3be126c835390e0d1240e671e4fad1607a6e8a99f658f2dcff0f8594944d61c2696b680379f8a76fc0ed4f156dc0f20b9d0ea17d1df5
@@ -0,0 +1,24 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ tests:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ ruby-version: ["3.3", "3.4", "4.0"]
18
+ steps:
19
+ - uses: actions/checkout@v6
20
+ - uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby-version }}
23
+ bundler-cache: true
24
+ - run: bundle exec rspec
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.2
1
+ 4.0.3
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 4.0.3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v0.6.1 2026-04-30
2
+ - Added `.validate_duration` and `.validates_durations` to `NxtSupport::DurationAttributeAccessor`
3
+
4
+ # v0.6.0 2024-09-27
5
+ - Added `NxtSupport::Uuid`
6
+
1
7
  # v0.5.0 2023-03-22
2
8
  - Add `rake_cli_options`
3
9
 
data/Gemfile CHANGED
@@ -2,7 +2,3 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in nxt_support.gemspec
4
4
  gemspec
5
-
6
- group :test do
7
- gem 'rspec_junit_formatter' # for CircleCI
8
- end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nxt_support (0.5.0)
4
+ nxt_support (0.6.1)
5
5
  activerecord
6
6
  activesupport
7
7
  nxt_init
@@ -10,51 +10,74 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activemodel (7.0.7.2)
14
- activesupport (= 7.0.7.2)
15
- activerecord (7.0.7.2)
16
- activemodel (= 7.0.7.2)
17
- activesupport (= 7.0.7.2)
18
- activesupport (7.0.7.2)
19
- concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ activemodel (8.1.3)
14
+ activesupport (= 8.1.3)
15
+ activerecord (8.1.3)
16
+ activemodel (= 8.1.3)
17
+ activesupport (= 8.1.3)
18
+ timeout (>= 0.4.0)
19
+ activesupport (8.1.3)
20
+ base64
21
+ bigdecimal
22
+ concurrent-ruby (~> 1.0, >= 1.3.1)
23
+ connection_pool (>= 2.2.5)
24
+ drb
20
25
  i18n (>= 1.6, < 2)
26
+ json
27
+ logger (>= 1.4.2)
21
28
  minitest (>= 5.1)
22
- tzinfo (~> 2.0)
29
+ securerandom (>= 0.3)
30
+ tzinfo (~> 2.0, >= 2.0.5)
31
+ uri (>= 0.13.1)
32
+ base64 (0.3.0)
33
+ bigdecimal (4.1.2)
23
34
  coderay (1.1.3)
24
- concurrent-ruby (1.2.2)
25
- diff-lcs (1.5.0)
26
- i18n (1.14.1)
35
+ concurrent-ruby (1.3.6)
36
+ connection_pool (3.0.2)
37
+ diff-lcs (1.6.2)
38
+ drb (2.2.3)
39
+ i18n (1.14.8)
27
40
  concurrent-ruby (~> 1.0)
28
- method_source (1.0.0)
29
- mini_portile2 (2.8.4)
30
- minitest (5.19.0)
41
+ io-console (0.8.2)
42
+ json (2.19.4)
43
+ logger (1.7.0)
44
+ method_source (1.1.0)
45
+ mini_portile2 (2.8.9)
46
+ minitest (6.0.5)
47
+ drb (~> 2.0)
48
+ prism (~> 1.5)
31
49
  nxt_init (0.1.5)
32
50
  activesupport
33
51
  nxt_registry (0.3.10)
34
52
  activesupport
35
- pry (0.14.2)
53
+ prism (1.9.0)
54
+ pry (0.16.0)
36
55
  coderay (~> 1.1)
37
56
  method_source (~> 1.0)
38
- rake (13.0.6)
39
- rspec (3.12.0)
40
- rspec-core (~> 3.12.0)
41
- rspec-expectations (~> 3.12.0)
42
- rspec-mocks (~> 3.12.0)
43
- rspec-core (3.12.2)
44
- rspec-support (~> 3.12.0)
45
- rspec-expectations (3.12.3)
57
+ reline (>= 0.6.0)
58
+ rake (13.4.2)
59
+ reline (0.6.3)
60
+ io-console (~> 0.5)
61
+ rspec (3.13.2)
62
+ rspec-core (~> 3.13.0)
63
+ rspec-expectations (~> 3.13.0)
64
+ rspec-mocks (~> 3.13.0)
65
+ rspec-core (3.13.6)
66
+ rspec-support (~> 3.13.0)
67
+ rspec-expectations (3.13.5)
46
68
  diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.12.0)
48
- rspec-mocks (3.12.6)
69
+ rspec-support (~> 3.13.0)
70
+ rspec-mocks (3.13.8)
49
71
  diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.12.0)
51
- rspec-support (3.12.1)
52
- rspec_junit_formatter (0.6.0)
53
- rspec-core (>= 2, < 4, != 2.12.0)
54
- sqlite3 (1.6.3)
72
+ rspec-support (~> 3.13.0)
73
+ rspec-support (3.13.7)
74
+ securerandom (0.4.1)
75
+ sqlite3 (2.9.3)
55
76
  mini_portile2 (~> 2.8.0)
77
+ timeout (0.6.1)
56
78
  tzinfo (2.0.6)
57
79
  concurrent-ruby (~> 1.0)
80
+ uri (1.1.1)
58
81
 
59
82
  PLATFORMS
60
83
  ruby
@@ -65,8 +88,7 @@ DEPENDENCIES
65
88
  pry
66
89
  rake
67
90
  rspec
68
- rspec_junit_formatter
69
91
  sqlite3
70
92
 
71
93
  BUNDLED WITH
72
- 2.2.25
94
+ 4.0.8
@@ -19,6 +19,16 @@ module NxtSupport
19
19
  define_duration_attribute_writer(attr_name)
20
20
  end
21
21
  end
22
+
23
+ def validates_durations(*attrs, **opts)
24
+ validates_each(*attrs, **opts) do |record, attr, value|
25
+ record.errors.add attr, "is not a valid iso8601 duration." unless record.is_valid_iso8601_duration?(value)
26
+ end
27
+ end
28
+
29
+ def validates_duration(attr, **opts)
30
+ validates_durations(attr, **opts)
31
+ end
22
32
 
23
33
  private
24
34
 
@@ -55,7 +65,7 @@ module NxtSupport
55
65
  def is_valid_iso8601_duration?(string)
56
66
  ActiveSupport::Duration.parse(string)
57
67
  true
58
- rescue ActiveSupport::Duration::ISO8601Parser::ParsingError
68
+ rescue ActiveSupport::Duration::ISO8601Parser::ParsingError, TypeError
59
69
  false
60
70
  end
61
71
  end
@@ -31,7 +31,9 @@ module NxtSupport
31
31
  class_methods do
32
32
  def indifferently_accessible_json_attrs(*attrs)
33
33
  attrs.each do |attr|
34
- serialize attr, JsonSerializer
34
+
35
+ serialize attr, coder: JsonSerializer
36
+ # serialize attr, JsonSerializer
35
37
  end
36
38
  end
37
39
 
@@ -0,0 +1,5 @@
1
+ module NxtSupport
2
+ class Uuid
3
+ REGEXP = /\A(\h{32}|\h{8}-\h{4}-\h{4}-\h{4}-\h{12})\z/
4
+ end
5
+ end
@@ -1,4 +1,5 @@
1
1
  require "nxt_support/models/email"
2
+ require "nxt_support/models/uuid"
2
3
  require "nxt_support/models/safely_find_or_createable"
3
4
  require "nxt_support/models/indifferently_accessible_json_attrs"
4
5
  require "nxt_support/models/assignable_values"
@@ -1,3 +1,3 @@
1
1
  module NxtSupport
2
- VERSION = "0.5.0".freeze
2
+ VERSION = "0.6.1".freeze
3
3
  end
data/nxt_support.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.bindir = "exe"
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
- spec.required_ruby_version = '>= 3.0.0'
29
+ spec.required_ruby_version = '>= 3.1.3'
30
30
 
31
31
  spec.add_dependency "activerecord"
32
32
  spec.add_dependency "activesupport"
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nxt_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nils Sommer
8
8
  - Andreas Robecke
9
9
  - Nicolai Stoianov
10
10
  - Akihiko Ito
11
- autorequire:
12
11
  bindir: exe
13
12
  cert_chain: []
14
- date: 2023-08-23 00:00:00.000000000 Z
13
+ date: 1980-01-02 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: activerecord
@@ -139,7 +138,6 @@ dependencies:
139
138
  - - ">="
140
139
  - !ruby/object:Gem::Version
141
140
  version: '0'
142
- description:
143
141
  email:
144
142
  - mail@nilssommer.de
145
143
  - a.robecke@getsafe.de
@@ -149,11 +147,12 @@ executables: []
149
147
  extensions: []
150
148
  extra_rdoc_files: []
151
149
  files:
152
- - ".circleci/config.yml"
153
150
  - ".editorconfig"
151
+ - ".github/workflows/ci.yml"
154
152
  - ".gitignore"
155
153
  - ".rspec"
156
154
  - ".ruby-version"
155
+ - ".tool-versions"
157
156
  - CHANGELOG.md
158
157
  - Gemfile
159
158
  - Gemfile.lock
@@ -174,6 +173,7 @@ files:
174
173
  - lib/nxt_support/models/indifferently_accessible_json_attrs.rb
175
174
  - lib/nxt_support/models/preprocess_attributes.rb
176
175
  - lib/nxt_support/models/safely_find_or_createable.rb
176
+ - lib/nxt_support/models/uuid.rb
177
177
  - lib/nxt_support/preprocessor.rb
178
178
  - lib/nxt_support/preprocessors/downcase_preprocessor.rb
179
179
  - lib/nxt_support/preprocessors/strip_preprocessor.rb
@@ -200,7 +200,6 @@ metadata:
200
200
  homepage_uri: https://github.com/nxt-insurance/nxt_support
201
201
  source_code_uri: https://github.com/nxt-insurance/nxt_support
202
202
  changelog_uri: https://github.com/nxt-insurance/nxt_support/CHANGELOG.md
203
- post_install_message:
204
203
  rdoc_options: []
205
204
  require_paths:
206
205
  - lib
@@ -208,15 +207,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
208
207
  requirements:
209
208
  - - ">="
210
209
  - !ruby/object:Gem::Version
211
- version: 3.0.0
210
+ version: 3.1.3
212
211
  required_rubygems_version: !ruby/object:Gem::Requirement
213
212
  requirements:
214
213
  - - ">="
215
214
  - !ruby/object:Gem::Version
216
215
  version: '0'
217
216
  requirements: []
218
- rubygems_version: 3.4.10
219
- signing_key:
217
+ rubygems_version: 4.0.6
220
218
  specification_version: 4
221
219
  summary: Support through reusable Mixins and Helpers for Ruby on Rails Applications
222
220
  test_files: []
data/.circleci/config.yml DELETED
@@ -1,53 +0,0 @@
1
- # Ruby CircleCI 2.0 configuration file
2
- #
3
- # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
- #
5
- version: 2.1
6
-
7
- workflows:
8
- build:
9
- jobs:
10
- - build:
11
- matrix:
12
- parameters:
13
- ruby-version: ["3.0.2", "3.1.3", "3.2.1", "3.2.2"]
14
- orbs:
15
- ruby: circleci/ruby@2.0.1
16
-
17
- jobs:
18
- build:
19
- parameters:
20
- ruby-version:
21
- type: string
22
-
23
- docker:
24
- # specify the version you desire here
25
- - image: cimg/ruby:<< parameters.ruby-version >>
26
-
27
- working_directory: ~/repo
28
-
29
- steps:
30
- - checkout
31
- - ruby/install-deps:
32
- key: gems-v2
33
- include-branch-in-cache-key: false
34
- - run:
35
- name: run tests
36
- command: |
37
- mkdir /tmp/test-results
38
- TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
39
- circleci tests split --split-by=timings)"
40
-
41
- bundle exec rspec \
42
- --format progress \
43
- --format RspecJunitFormatter \
44
- --out /tmp/test-results/rspec.xml \
45
- --format progress \
46
- $TEST_FILES
47
-
48
- # collect reports
49
- - store_test_results:
50
- path: /tmp/test-results
51
- - store_artifacts:
52
- path: /tmp/test-results
53
- destination: test-results