validates_hostname 2.0.45 → 2.0.46
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 +4 -4
- data/.github/workflows/release.yml +6 -1
- data/.github/workflows/tld-update.yml +1 -1
- data/README.md +12 -0
- data/Rakefile +4 -0
- data/data/tlds.txt +1 -1
- data/lib/validates_hostname/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c479c8efef9b7b4b7e2f3fa9dd80a4597720cb2cec136e1794b816fb9462ca64
|
|
4
|
+
data.tar.gz: d9b13ff0142dc43ba2a0ffacbf00647a3b19586fbdac15e8738b6f0b4e2284db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd8c3a56fd76476e6181ffaf40fe0dafcc458ec515d89eea5016038a9a1b49dc50edd3ee7385056b3f525212f5208b9ec439f7d33d5fd7dcd6e18f1510bc71fb
|
|
7
|
+
data.tar.gz: 537e1130c16816fb5ef0e6089266c75c4a7e429494226beed15eeb28467af3276e6b82722d6c05ac9f810ed65e00c46b35dc1fa2160652ac0a5caa95fec3d55c
|
|
@@ -10,7 +10,7 @@ jobs:
|
|
|
10
10
|
name: Release to RubyGems.org
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
permissions:
|
|
13
|
-
contents:
|
|
13
|
+
contents: write
|
|
14
14
|
|
|
15
15
|
steps:
|
|
16
16
|
- name: Checkout code
|
|
@@ -35,3 +35,8 @@ jobs:
|
|
|
35
35
|
|
|
36
36
|
- name: Push gem to RubyGems.org
|
|
37
37
|
run: gem push *.gem
|
|
38
|
+
|
|
39
|
+
- name: Create GitHub Release
|
|
40
|
+
uses: softprops/action-gh-release@v3
|
|
41
|
+
with:
|
|
42
|
+
generate_release_notes: true
|
data/README.md
CHANGED
|
@@ -93,6 +93,18 @@ end
|
|
|
93
93
|
- `allow_wildcard_hostname`: Permits a wildcard character (`*`) as the first label of the hostname (e.g., `*.example.com`). (default: `false`)
|
|
94
94
|
- `allow_root_label`: Permits a trailing dot (root label) in the hostname (e.g., `example.com.`). (default: `false`)
|
|
95
95
|
|
|
96
|
+
## TLD Updates
|
|
97
|
+
|
|
98
|
+
The default list of valid TLDs (stored in `data/tlds.txt`) is automatically updated from IANA on a quarterly basis via a GitHub Action. If a new TLD has been released and you need to support it immediately before the next quarterly gem update, you can override the valid TLD list by passing an updated array to the `valid_tlds` option:
|
|
99
|
+
|
|
100
|
+
```ruby
|
|
101
|
+
# Example of appending a new TLD to the default list
|
|
102
|
+
validates :name, hostname: {
|
|
103
|
+
require_valid_tld: true,
|
|
104
|
+
valid_tlds: ValidatesHostname::TLDs + ['newtld']
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
96
108
|
## Examples
|
|
97
109
|
|
|
98
110
|
Without options:
|
data/Rakefile
CHANGED
|
@@ -36,6 +36,10 @@ namespace :tlds do
|
|
|
36
36
|
begin
|
|
37
37
|
response = Net::HTTP.get(uri)
|
|
38
38
|
|
|
39
|
+
unless response.match?(/^COM$/i) && response.match?(/^ORG$/i) && response.match?(/^NET$/i)
|
|
40
|
+
raise "Downloaded TLD list appears invalid (missing COM, ORG, or NET)."
|
|
41
|
+
end
|
|
42
|
+
|
|
39
43
|
File.write('data/tlds.txt', response)
|
|
40
44
|
|
|
41
45
|
puts 'Successfully updated data/tlds.txt.'
|
data/data/tlds.txt
CHANGED