license_plate_validator 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/release.yml +29 -0
- data/.github/workflows/test.yml +43 -0
- data/.travis.yml +13 -1
- data/CHANGELOG +19 -0
- data/README.md +10 -5
- data/RELEASING.md +8 -0
- data/gemfiles/Gemfile.rails7.0 +5 -0
- data/gemfiles/Gemfile.rails7.1 +5 -0
- data/gemfiles/Gemfile.rails7.2 +5 -0
- data/gemfiles/{standalone → Gemfile.ruby} +1 -1
- data/lib/license_plate_validator/locales/de.yml +4 -0
- data/lib/license_plate_validator/locales/nl.yml +1 -1
- data/lib/license_plate_validator/version.rb +1 -1
- data/lib/license_plate_validator.rb +19 -8
- data/license_plate_validator.gemspec +5 -5
- data/spec/license_plate_validator/active_model_spec.rb +23 -21
- data/spec/license_plate_validator_spec.rb +43 -13
- metadata +23 -20
- data/gem-private_key.pem +0 -27
- data/gem-public_cert.pem +0 -21
- data/gemfiles/activemodel-3-2 +0 -5
- data/gemfiles/activemodel-4 +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4b14548fad67c137489b550601ec07d6c2bdbffd370041f110dedef142be237c
|
4
|
+
data.tar.gz: c722040730ca5c1f7e6343a29c08b5f3b5b4962f0154d7bf69470f00f4cb47b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b9aaeb5f62a2424afc70df1d44cda8ca1c4546c54d2a3f9e3ced7680e1bb022ce4dbc3479a3859fb28bb61c51a55832e458bfe9019211fc81545d171c04a3d2
|
7
|
+
data.tar.gz: 01f958e7128b87caef078f52df6fba5c168ed35654dcc40715d554daa059514cbd4fca157b69b3426607e9e22c60d50935fdaa1d543a6d3f0d07e45a4bf5748d
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: Release to Rubygems
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- v*
|
7
|
+
|
8
|
+
permissions:
|
9
|
+
contents: read
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
push:
|
13
|
+
if: github.repository == 'ariejan/license_plate_validator'
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
contents: write
|
18
|
+
id-token: write
|
19
|
+
|
20
|
+
steps:
|
21
|
+
- uses: actions/checkout@v4
|
22
|
+
- name: Set up Ruby
|
23
|
+
uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
bundler-cache: true
|
26
|
+
ruby-version: ruby
|
27
|
+
|
28
|
+
# Release
|
29
|
+
- uses: rubygems/release-gem@v1
|
@@ -0,0 +1,43 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
ruby-version:
|
16
|
+
- 3.1
|
17
|
+
- 3.2
|
18
|
+
- 3.3
|
19
|
+
- 3.4
|
20
|
+
gemfile:
|
21
|
+
- gemfiles/Gemfile.ruby
|
22
|
+
- gemfiles/Gemfile.rails7.0
|
23
|
+
- gemfiles/Gemfile.rails7.1
|
24
|
+
- gemfiles/Gemfile.rails7.2
|
25
|
+
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@v4
|
28
|
+
|
29
|
+
- name: Set up Ruby
|
30
|
+
uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby-version }}
|
33
|
+
|
34
|
+
- name: Install dependencies
|
35
|
+
run: |
|
36
|
+
gem install bundler
|
37
|
+
bundle install --gemfile=${{ matrix.gemfile }}
|
38
|
+
|
39
|
+
- name: Run tests
|
40
|
+
run: |
|
41
|
+
bundle exec rspec
|
42
|
+
env:
|
43
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
data/.travis.yml
CHANGED
@@ -1,7 +1,19 @@
|
|
1
1
|
language: ruby
|
2
|
+
|
3
|
+
notifications:
|
4
|
+
email: false
|
5
|
+
|
2
6
|
rvm:
|
3
7
|
- 2.0.0
|
4
|
-
- 1.
|
8
|
+
- 2.1.1
|
9
|
+
- jruby-19mode
|
10
|
+
- ruby-head
|
11
|
+
|
12
|
+
matrix:
|
13
|
+
allow_failures:
|
14
|
+
- rvm: jruby-19mode
|
15
|
+
- rvm: ruby-head
|
16
|
+
|
5
17
|
gemfile:
|
6
18
|
- gemfiles/activemodel-4
|
7
19
|
- gemfiles/activemodel-3-2
|
data/CHANGELOG
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## 2.0.0 - 2024-09-24
|
4
|
+
|
5
|
+
- Update dependencies; this may break older Ruby (< 3.1) and Rails (< 7.x) integrations.
|
6
|
+
- Add new NL license plate formats - @edwardmp
|
7
|
+
|
8
|
+
## 1.2.0 - 2014-07-28
|
9
|
+
|
10
|
+
- German license plate support
|
11
|
+
- German language support
|
12
|
+
|
13
|
+
## 1.1.1 - 2014-04-25
|
14
|
+
|
15
|
+
- Fix i18n key
|
16
|
+
|
17
|
+
## 1.0 - 2013-04-23
|
18
|
+
|
19
|
+
- Initial release with Dutch license plate support
|
data/README.md
CHANGED
@@ -1,21 +1,23 @@
|
|
1
1
|
# License Plate Validator
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/license_plate_validator.png)](http://badge.fury.io/rb/license_plate_validator)
|
4
|
-
[![
|
4
|
+
[![Ruby CI](https://github.com/ariejan/license_plate_validator/actions/workflows/test.yml/badge.svg)](https://github.com/ariejan/license_plate_validator/actions)
|
5
5
|
|
6
6
|
This gem allows you to easily valdiate license plate fields to be valid
|
7
7
|
license plates.
|
8
8
|
|
9
9
|
We're planning on supporting multiple countries, but at this time we can
|
10
|
-
only validate Dutch license plates.
|
10
|
+
only validate Dutch and German license plates.
|
11
11
|
|
12
12
|
## Features
|
13
13
|
|
14
|
-
|
14
|
+
Validates Dutch license plates ("kentekens"), includes all ten common Dutch license
|
15
15
|
plate types.
|
16
16
|
|
17
17
|
Special license plates (like those for the Royal family) are not supported.
|
18
18
|
|
19
|
+
Also supports most german license plates, including most diplomatic formats.
|
20
|
+
|
19
21
|
## Installation
|
20
22
|
|
21
23
|
Add this line to your application's Gemfile:
|
@@ -38,7 +40,7 @@ Or install it yourself as:
|
|
38
40
|
LicensePlateValidator.new("SBA 5226", country: :nl).valid?
|
39
41
|
#=> false
|
40
42
|
|
41
|
-
###
|
43
|
+
### Ruby on Rails support
|
42
44
|
|
43
45
|
You can use LicensePlateValidator with any ActiveModel class, including
|
44
46
|
ActiveRecord models:
|
@@ -66,10 +68,11 @@ The `Proc` must return either `nil` (accept all the things) or a valid country c
|
|
66
68
|
### Supported countries
|
67
69
|
|
68
70
|
* `:nl` Netherlands; all common "sidecode" number formats.
|
71
|
+
* `:de` Germany; all regular forms as well as the common diplomatic variants
|
69
72
|
|
70
73
|
## I18n
|
71
74
|
|
72
|
-
Locales for English and
|
75
|
+
Locales for English, Dutch and German are provided. See [`lib/license_plate_validator/locales`](https://github.com/ariejan/license_plate_validator/tree/master/lib/license_plate_validator/locales)
|
73
76
|
for details.
|
74
77
|
|
75
78
|
## Contributing
|
@@ -99,6 +102,8 @@ specs.
|
|
99
102
|
## Contributor
|
100
103
|
|
101
104
|
* Pascal Widdershoven - for the original regexes for Dutch license plate numbers.
|
105
|
+
* Edward Poot - for adding new RDW approved license plate schemes
|
106
|
+
* Marcus Ilgner, evopark - for german license plates
|
102
107
|
|
103
108
|
## License
|
104
109
|
|
data/RELEASING.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
## Releasing
|
2
|
+
|
3
|
+
1. Update version file in `lib/license_plate_validator/version.rb` and run `bundle install`.
|
4
|
+
1. Update `CHANGELOG` to reflect the changes in this release.
|
5
|
+
1. Commit changes to `master`.
|
6
|
+
1. Tag the release: `git tag -s vVERSION`
|
7
|
+
1. Push changes: `git push && git push --tags`
|
8
|
+
1. That's is. Github Actions will release the gem to Rubygems.org
|
@@ -12,7 +12,24 @@ class LicensePlateValidator
|
|
12
12
|
/^([0-9]{2})-?([a-zA-Z]{3})-?([0-9]{1})$/,
|
13
13
|
/^([0-9]{1})-?([a-zA-Z]{3})-?([0-9]{2})$/,
|
14
14
|
/^([a-zA-Z]{2})-?([0-9]{3})-?([a-zA-Z]{1})$/,
|
15
|
-
/^([a-zA-Z]{1})-?([0-9]{3})-?([a-zA-Z]{2})
|
15
|
+
/^([a-zA-Z]{1})-?([0-9]{3})-?([a-zA-Z]{2})$/,
|
16
|
+
/^([a-zA-Z]{3})-?([0-9]{2})-?([a-zA-Z])$/,
|
17
|
+
/^([0-9]{3})-?([a-zA-Z]{2})-?([0-9])$/,
|
18
|
+
/^([a-zA-Z])-?([0-9]{2})-?([a-zA-Z]{3})$/,
|
19
|
+
/^([0-9])-?([a-zA-Z]{2})-?([0-9]{3})$/
|
20
|
+
],
|
21
|
+
# Germany
|
22
|
+
de: [
|
23
|
+
# first part: distinguisher for area
|
24
|
+
# second part (a) 1-2 characters followed by 1-4 numbers
|
25
|
+
# or (b) for diplomatic purposes:
|
26
|
+
# 1. a 4-digit number starting with 9
|
27
|
+
# 2. a 2-3-digit-number (country identifier) followed by 1-3 digits
|
28
|
+
# diplomatic license plates can be followed by a single letter
|
29
|
+
# regular license plates can be followed by an 'H' for oldtimers
|
30
|
+
/^(A|AA|AB|ABG|ABI|AC|AE|AD|AF|AIC|AK|ALF|AM|AN|ANA|ANK|AÖ|AP|APD|ARN|ART|AS|ASL|ASZ|AT|AU|AUR|AW|AZ|AZE|B|BA|BAD|BAR|BB|BBG|BC|BCH|BD|BED|BER|BF|BGL|BI|BID|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lateValidator
|
|
21
38
|
country: nil
|
22
39
|
}.merge(options)
|
23
40
|
|
24
|
-
@raw =
|
41
|
+
@raw = raw || ''
|
25
42
|
end
|
26
43
|
|
27
44
|
attr_reader :raw
|
@@ -47,12 +64,6 @@ class LicensePlateValidator
|
|
47
64
|
def to_s
|
48
65
|
raw
|
49
66
|
end
|
50
|
-
|
51
|
-
private
|
52
|
-
|
53
|
-
def normalize(input)
|
54
|
-
input.to_s.upcase.strip.gsub(/[^A-Z0-9]/, '')
|
55
|
-
end
|
56
67
|
end
|
57
68
|
|
58
69
|
require 'license_plate_validator/version'
|
@@ -12,14 +12,14 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.summary = %q{Validate license plate numbers for countries that support it.}
|
13
13
|
spec.homepage = "https://ariejan.github.io/license_plate_validator"
|
14
14
|
spec.license = "MIT"
|
15
|
-
|
15
|
+
spec.required_ruby_version = ">= 3.1"
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler", "~>
|
22
|
-
spec.add_development_dependency "rspec", "~>
|
23
|
-
spec.add_development_dependency "rake"
|
24
|
-
spec.add_development_dependency 'activemodel', '~>
|
21
|
+
spec.add_development_dependency "bundler", "~> 2.5"
|
22
|
+
spec.add_development_dependency "rspec", "~> 3.13.0"
|
23
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
24
|
+
spec.add_development_dependency 'activemodel', '~> 7'
|
25
25
|
end
|
@@ -14,33 +14,35 @@ if defined?(ActiveModel)
|
|
14
14
|
validates :number, license_plate: true
|
15
15
|
end
|
16
16
|
|
17
|
-
describe
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
RSpec.describe "Ruby on Rails ActiveModel support" do
|
18
|
+
context DutchVehicle do
|
19
|
+
it "accepts Dutch plates only" do
|
20
|
+
obj = DutchVehicle.new(number: "60-NFH-1")
|
21
|
+
expect(obj).to be_valid
|
22
|
+
|
23
|
+
obj = DutchVehicle.new(number: "SBA5226")
|
24
|
+
expect(obj).not_to be_valid
|
25
|
+
end
|
24
26
|
end
|
25
|
-
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
context DutchMethodVehicle do
|
29
|
+
it "accepts Dutch plates only" do
|
30
|
+
obj = DutchMethodVehicle.new(number: "60-NFH-1", country: "nl")
|
31
|
+
expect(obj).to be_valid
|
31
32
|
|
32
|
-
|
33
|
-
|
33
|
+
obj = DutchMethodVehicle.new(number: "SBA5226", country: "nl")
|
34
|
+
expect(obj).not_to be_valid
|
35
|
+
end
|
34
36
|
end
|
35
|
-
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
context UnknownVehicle do
|
39
|
+
it "accepts both Dutch and German plates" do
|
40
|
+
obj = UnknownVehicle.new(number: "60-NFH-1")
|
41
|
+
expect(obj).to be_valid
|
41
42
|
|
42
|
-
|
43
|
-
|
43
|
+
obj = UnknownVehicle.new(number: "SBA5226")
|
44
|
+
expect(obj).to be_valid
|
45
|
+
end
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
@@ -1,29 +1,24 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe LicensePlateValidator do
|
3
|
+
RSpec.describe LicensePlateValidator do
|
4
4
|
it 'should have a version number' do
|
5
|
-
LicensePlateValidator::VERSION.
|
5
|
+
expect(LicensePlateValidator::VERSION).not_to be_nil
|
6
6
|
end
|
7
7
|
|
8
|
-
|
8
|
+
context "#new" do
|
9
9
|
it 'demands one argument, optionally a second' do
|
10
|
-
expect { LicensePlateValidator.new() }.to raise_error
|
10
|
+
expect { LicensePlateValidator.new() }.to raise_error(ArgumentError)
|
11
11
|
expect { LicensePlateValidator.new ("a") }.not_to raise_error
|
12
12
|
expect { LicensePlateValidator.new("a", country: :nl) }.not_to raise_error
|
13
13
|
expect { LicensePlateValidator.new("a", country: nil) }.not_to raise_error
|
14
14
|
end
|
15
|
-
|
16
|
-
it 'normalizes the input string' do
|
17
|
-
expect(LicensePlateValidator.new('60-NFH-1').to_s).to eql('60NFH1')
|
18
|
-
expect(LicensePlateValidator.new('fz-xx-61').to_s).to eql('FZXX61')
|
19
|
-
end
|
20
15
|
end
|
21
16
|
|
22
17
|
context "#supported countries" do
|
23
18
|
subject { LicensePlateValidator.new("a") }
|
24
19
|
|
25
20
|
it "returns array of symbols" do
|
26
|
-
expect(subject.supported_countries).to eql([:nl])
|
21
|
+
expect(subject.supported_countries).to eql([:nl, :de])
|
27
22
|
end
|
28
23
|
end
|
29
24
|
|
@@ -35,7 +30,7 @@ describe LicensePlateValidator do
|
|
35
30
|
end
|
36
31
|
|
37
32
|
it "returns array of patterns for known countries" do
|
38
|
-
expect(subject.patterns_for_country(:nl).size).to eql(
|
33
|
+
expect(subject.patterns_for_country(:nl).size).to eql(14)
|
39
34
|
end
|
40
35
|
end
|
41
36
|
|
@@ -84,14 +79,18 @@ describe LicensePlateValidator do
|
|
84
79
|
"61-NFH-1",
|
85
80
|
"1-KGB-42",
|
86
81
|
"FZ-142-X",
|
87
|
-
"X-721-FZ"
|
82
|
+
"X-721-FZ",
|
83
|
+
"GBB-01-B",
|
84
|
+
"V-01-BBB",
|
85
|
+
"9-XX-999",
|
86
|
+
"999-XX-9"
|
88
87
|
]
|
89
88
|
|
90
89
|
NL_INVALID_SAMPLES = [
|
91
90
|
"DEF-123",
|
92
91
|
"123-DEF",
|
93
92
|
"DEFGHI",
|
94
|
-
"123456"
|
93
|
+
"123456",
|
95
94
|
]
|
96
95
|
|
97
96
|
NL_VALID_SAMPLES.each do |number|
|
@@ -108,4 +107,35 @@ describe LicensePlateValidator do
|
|
108
107
|
end
|
109
108
|
end
|
110
109
|
end
|
110
|
+
|
111
|
+
context "DE - Germany" do
|
112
|
+
DE_VALID_SAMPLES = [
|
113
|
+
"K-AB-123",
|
114
|
+
"GL-A-123H",
|
115
|
+
"AC A123",
|
116
|
+
"K-9123",
|
117
|
+
"0-12-123",
|
118
|
+
"0-12-234H"
|
119
|
+
]
|
120
|
+
|
121
|
+
DE_INVALID_SAMPLES = [
|
122
|
+
"FOO-AB-123",
|
123
|
+
"123",
|
124
|
+
"K-2"
|
125
|
+
]
|
126
|
+
|
127
|
+
DE_VALID_SAMPLES.each do |sample|
|
128
|
+
it "accepts '#{sample}'" do
|
129
|
+
license = LicensePlateValidator.new(sample, country: :de)
|
130
|
+
expect(license).to be_valid
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
DE_INVALID_SAMPLES.each do |sample|
|
135
|
+
it "rejects '#{sample}'" do
|
136
|
+
license = LicensePlateValidator.new(sample, country: :de)
|
137
|
+
expect(license).to_not be_valid
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
111
141
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: license_plate_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ariejan de Vroom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.5'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 3.13.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 3.13.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activemodel
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '7'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '7'
|
69
69
|
description: Formatting and content of license plate codes can be validated in some
|
70
70
|
countries. This gem add Rails validators for this to your project.
|
71
71
|
email:
|
@@ -74,20 +74,24 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
+
- ".github/workflows/release.yml"
|
78
|
+
- ".github/workflows/test.yml"
|
77
79
|
- ".gitignore"
|
78
80
|
- ".rspec"
|
79
81
|
- ".travis.yml"
|
82
|
+
- CHANGELOG
|
80
83
|
- Gemfile
|
81
84
|
- LICENSE.txt
|
82
85
|
- README.md
|
86
|
+
- RELEASING.md
|
83
87
|
- Rakefile
|
84
|
-
-
|
85
|
-
-
|
86
|
-
- gemfiles/
|
87
|
-
- gemfiles/
|
88
|
-
- gemfiles/standalone
|
88
|
+
- gemfiles/Gemfile.rails7.0
|
89
|
+
- gemfiles/Gemfile.rails7.1
|
90
|
+
- gemfiles/Gemfile.rails7.2
|
91
|
+
- gemfiles/Gemfile.ruby
|
89
92
|
- lib/license_plate_validator.rb
|
90
93
|
- lib/license_plate_validator/active_model.rb
|
94
|
+
- lib/license_plate_validator/locales/de.yml
|
91
95
|
- lib/license_plate_validator/locales/en.yml
|
92
96
|
- lib/license_plate_validator/locales/nl.yml
|
93
97
|
- lib/license_plate_validator/version.rb
|
@@ -107,15 +111,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
111
|
requirements:
|
108
112
|
- - ">="
|
109
113
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
114
|
+
version: '3.1'
|
111
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
116
|
requirements:
|
113
117
|
- - ">="
|
114
118
|
- !ruby/object:Gem::Version
|
115
119
|
version: '0'
|
116
120
|
requirements: []
|
117
|
-
|
118
|
-
rubygems_version: 2.2.1
|
121
|
+
rubygems_version: 3.5.16
|
119
122
|
signing_key:
|
120
123
|
specification_version: 4
|
121
124
|
summary: Validate license plate numbers for countries that support it.
|
data/gem-private_key.pem
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
-----BEGIN RSA PRIVATE KEY-----
|
2
|
-
MIIEpAIBAAKCAQEAyt2l9tkc4bL1zgKZk9UiNbqNElgCuRzV1pfk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