validates_hostname 1.0.13 → 2.0.0
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/ci.yml +23 -0
- data/.github/workflows/release.yml +37 -0
- data/.github/workflows/tld-update.yml +59 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.rubocop.yml +35 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +17 -0
- data/Guardfile +12 -0
- data/LICENSE +21 -0
- data/README.md +349 -0
- data/Rakefile +34 -59
- data/config/locales/de.yaml +12 -0
- data/config/locales/en.yaml +12 -0
- data/config/locales/es.yaml +12 -0
- data/config/locales/fr.yaml +12 -0
- data/config/locales/zh.yaml +12 -0
- data/data/tlds.txt +1440 -0
- data/lib/validates_hostname/version.rb +4 -4
- data/lib/validates_hostname.rb +218 -287
- data/validates_hostname.gemspec +18 -39
- metadata +35 -114
- data/CHANGELOG.rdoc +0 -4
- data/MIT-LICENSE +0 -20
- data/README.rdoc +0 -205
data/Rakefile
CHANGED
@@ -1,72 +1,47 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require 'rubygems/specification'
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'net/http'
|
6
5
|
require 'rspec/core/rake_task'
|
7
|
-
require '
|
6
|
+
require 'rubocop/rake_task'
|
8
7
|
|
9
|
-
|
10
|
-
|
8
|
+
# Set the default task to run both specs and linting.
|
9
|
+
task default: :ci
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
16
|
-
s.authors = ["Kim Nørgaard"]
|
17
|
-
s.description = 'Extension to ActiveRecord::Base for validating hostnames'
|
18
|
-
s.summary = 'Checks for valid hostnames'
|
19
|
-
s.email = 'jasen@jasen.dk'
|
20
|
-
s.extra_rdoc_files = ["README.rdoc", "CHANGELOG.rdoc", "MIT-LICENSE"]
|
21
|
-
s.files = ["validates_hostname.gemspec", "MIT-LICENSE", "CHANGELOG.rdoc", "README.rdoc", "Rakefile", "lib/validates_hostname", "lib/validates_hostname/version.rb", "lib/validates_hostname.rb"]
|
22
|
-
s.homepage = %q{https://github.com/KimNorgaard/validates_hostname}
|
23
|
-
s.licenses = 'MIT'
|
24
|
-
s.require_paths = ["lib"]
|
25
|
-
s.add_runtime_dependency 'activerecord', '>= 3.0'
|
26
|
-
s.add_runtime_dependency 'activesupport', '>= 3.0'
|
27
|
-
s.add_development_dependency 'rspec', '~> 3.0'
|
28
|
-
s.add_development_dependency 'rspec-rails'
|
29
|
-
s.add_development_dependency 'rails'
|
30
|
-
s.add_development_dependency 'sqlite3'
|
31
|
-
s.add_development_dependency 'pry-byebug'
|
32
|
-
s.add_development_dependency 'rspec-collection_matchers'
|
33
|
-
end
|
11
|
+
# --- Testing Tasks ---
|
12
|
+
desc 'Run RSpec tests'
|
13
|
+
RSpec::Core::RakeTask.new(:spec)
|
34
14
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
t.pattern = 'test/*_test.rb'
|
39
|
-
t.verbose = true
|
40
|
-
end
|
15
|
+
# --- Linting Tasks ---
|
16
|
+
desc 'Run RuboCop for static analysis'
|
17
|
+
RuboCop::RakeTask.new(:rubocop)
|
41
18
|
|
42
|
-
|
43
|
-
|
19
|
+
# --- Continuous Integration Task ---
|
20
|
+
desc 'Run all tests and linters'
|
21
|
+
task ci: %i[spec rubocop]
|
44
22
|
|
45
|
-
|
46
|
-
|
47
|
-
|
23
|
+
# --- Development Tasks ---
|
24
|
+
desc 'Open an IRB console with the gem loaded'
|
25
|
+
task :console do
|
26
|
+
sh 'irb -Ilib -rvalidates_hostname'
|
48
27
|
end
|
49
28
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
29
|
+
# --- TLD Update Task ---
|
30
|
+
namespace :tlds do
|
31
|
+
desc 'Update the TLD list from IANA'
|
32
|
+
task :update do
|
33
|
+
uri = URI('http://data.iana.org/TLD/tlds-alpha-by-domain.txt')
|
34
|
+
puts "Fetching latest TLDs from #{uri}..."
|
57
35
|
|
58
|
-
|
59
|
-
|
60
|
-
end
|
36
|
+
begin
|
37
|
+
response = Net::HTTP.get(uri)
|
61
38
|
|
62
|
-
|
63
|
-
task :install => [:package] do
|
64
|
-
sh %{gem install pkg/#{GEM_NAME}-#{GEM_VERSION}}
|
65
|
-
end
|
39
|
+
File.write('data/tlds.txt', response)
|
66
40
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
41
|
+
puts 'Successfully updated data/tlds.txt.'
|
42
|
+
rescue StandardError => e
|
43
|
+
warn "An error occurred during TLD update: #{e.message}"
|
44
|
+
exit 1
|
45
|
+
end
|
71
46
|
end
|
72
47
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
de:
|
2
|
+
errors:
|
3
|
+
messages:
|
4
|
+
invalid_hostname_length: "muss zwischen 1 und 255 Zeichen lang sein"
|
5
|
+
invalid_label_length: "muss zwischen 1 und 63 Zeichen lang sein"
|
6
|
+
label_begins_or_ends_with_hyphen: "beginnt oder endet mit einem Bindestrich"
|
7
|
+
label_contains_invalid_characters: "enthält ungültige Zeichen (gültige Zeichen: [%{valid_chars}])"
|
8
|
+
hostname_label_is_numeric: "der nicht qualifizierte Hostname-Teil darf nicht nur aus numerischen Werten bestehen"
|
9
|
+
hostname_is_not_fqdn: "ist kein vollqualifizierter Domainname"
|
10
|
+
single_numeric_hostname_label: "darf nicht aus einem einzigen numerischen Label bestehen"
|
11
|
+
hostname_contains_consecutive_dots: "darf keine aufeinanderfolgenden Punkte enthalten"
|
12
|
+
hostname_ends_with_dot: "darf nicht mit einem Punkt enden"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
en:
|
2
|
+
errors:
|
3
|
+
messages:
|
4
|
+
invalid_hostname_length: "must be between 1 and 255 characters long"
|
5
|
+
invalid_label_length: "must be between 1 and 63 characters long"
|
6
|
+
label_begins_or_ends_with_hyphen: "begins or ends with a hyphen"
|
7
|
+
label_contains_invalid_characters: "contains invalid characters (valid characters: [%{valid_chars}])"
|
8
|
+
hostname_label_is_numeric: "unqualified hostname part cannot consist of numeric values only"
|
9
|
+
hostname_is_not_fqdn: "is not a fully qualified domain name"
|
10
|
+
single_numeric_hostname_label: "cannot consist of a single numeric label"
|
11
|
+
hostname_contains_consecutive_dots: "must not contain consecutive dots"
|
12
|
+
hostname_ends_with_dot: "must not end with a dot"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
es:
|
2
|
+
errors:
|
3
|
+
messages:
|
4
|
+
invalid_hostname_length: "debe tener entre 1 y 255 caracteres"
|
5
|
+
invalid_label_length: "debe tener entre 1 y 63 caracteres"
|
6
|
+
label_begins_or_ends_with_hyphen: "comienza o termina con un guión"
|
7
|
+
label_contains_invalid_characters: "contiene caracteres inválidos (caracteres válidos: [%{valid_chars}])"
|
8
|
+
hostname_label_is_numeric: "la parte del nombre de host no calificada no puede consistir solo en valores numéricos"
|
9
|
+
hostname_is_not_fqdn: "no es un nombre de dominio completo"
|
10
|
+
single_numeric_hostname_label: "no puede consistir en una sola etiqueta numérica"
|
11
|
+
hostname_contains_consecutive_dots: "no debe contener puntos consecutivos"
|
12
|
+
hostname_ends_with_dot: "no debe terminar con un punto"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
fr:
|
2
|
+
errors:
|
3
|
+
messages:
|
4
|
+
invalid_hostname_length: "doit avoir entre 1 et 255 caractères"
|
5
|
+
invalid_label_length: "doit avoir entre 1 et 63 caractères"
|
6
|
+
label_begins_or_ends_with_hyphen: "commence ou se termine par un trait d'union"
|
7
|
+
label_contains_invalid_characters: "contient des caractères non valides (caractères valides: [%{valid_chars}])"
|
8
|
+
hostname_label_is_numeric: "la partie non qualifiée du nom d'hôte ne peut pas être constituée uniquement de valeurs numériques"
|
9
|
+
hostname_is_not_fqdn: "n'est pas un nom de domaine complet"
|
10
|
+
single_numeric_hostname_label: "ne peut pas consister en une seule étiquette numérique"
|
11
|
+
hostname_contains_consecutive_dots: "ne doit pas contenir de points consécutifs"
|
12
|
+
hostname_ends_with_dot: "ne doit pas se terminer par un point"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
zh:
|
2
|
+
errors:
|
3
|
+
messages:
|
4
|
+
invalid_hostname_length: "长度必须在 1 到 255 个字符之间"
|
5
|
+
invalid_label_length: "长度必须在 1 到 63 个字符之间"
|
6
|
+
label_begins_or_ends_with_hyphen: "以连字符开头或结尾"
|
7
|
+
label_contains_invalid_characters: "包含无效字符 (有效字符: [%{valid_chars}])"
|
8
|
+
hostname_label_is_numeric: "非限定主机名部分不能仅由数值组成"
|
9
|
+
hostname_is_not_fqdn: "不是完全限定的域名"
|
10
|
+
single_numeric_hostname_label: "不能由单个数字标签组成"
|
11
|
+
hostname_contains_consecutive_dots: "不得包含连续的点"
|
12
|
+
hostname_ends_with_dot: "不得以点结尾"
|