From 3a3c6b8a0af1e0d43478f145108e7a40d569008f Mon Sep 17 00:00:00 2001
From: Piotr Stefanski
Date: Fri, 7 Feb 2025 13:34:03 +0100
Subject: [PATCH 01/12] [PEDSP-15739] Bump public-suffix gem
---
.github/workflows/ci.yml | 8 ++---
.rubocop.yml | 2 +-
VERSION.yml | 2 +-
validate_url.gemspec | 63 ++++++++++++++++++++--------------------
4 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e631b5d..f2c9bc7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -9,11 +9,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- ruby-version: ['2.6.10']
+ ruby-version: ['2.7.8', '3.0.7']
steps:
- uses: actions/checkout@v3
- name: Set up Ruby ${{ matrix.ruby-version }}
- uses: ruby/setup-ruby@v1.133.0
+ uses: ruby/setup-ruby@v1.218.0
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
@@ -24,14 +24,14 @@ jobs:
name: linters / rubocop
runs-on: ubuntu-latest
env:
- RUBY_VERSION: 2.6.10
+ RUBY_VERSION: 2.7.8
RUBOCOP_VERSION: 1.41.1
steps:
- name: Codebase Checkout
uses: actions/checkout@v3
- name: Setup Ruby
- uses: ruby/setup-ruby@v1.133.0
+ uses: ruby/setup-ruby@v1.218.0
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
diff --git a/.rubocop.yml b/.rubocop.yml
index da4db36..050a1f3 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,2 +1,2 @@
AllCops:
- TargetRubyVersion: 2.6
+ TargetRubyVersion: 2.7
diff --git a/VERSION.yml b/VERSION.yml
index 4a08c4f..c9986fd 100644
--- a/VERSION.yml
+++ b/VERSION.yml
@@ -1,5 +1,5 @@
---
:major: 1
:minor: 0
-:patch: 2
+:patch: 4
:build:
diff --git a/validate_url.gemspec b/validate_url.gemspec
index 211f796..6152e2f 100644
--- a/validate_url.gemspec
+++ b/validate_url.gemspec
@@ -2,45 +2,46 @@
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
+
# stub: validate_url 1.0.3 ruby lib
Gem::Specification.new do |s|
- s.name = "validate_url"
- s.version = "1.0.3"
+ s.name = 'validate_url'
+ s.version = '1.0.4'
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.require_paths = ["lib"]
- s.authors = ["Tanel Suurhans", "Tarmo Lehtpuu", "Vladimir Krylov"]
- s.date = "2015-07-21"
- s.description = "Library for validating urls in Rails."
+ s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
+ s.require_paths = ['lib']
+ s.authors = ['Tanel Suurhans', 'Tarmo Lehtpuu', 'Vladimir Krylov']
+ s.date = '2015-07-21'
+ s.description = 'Library for validating urls in Rails.'
s.license = 'MIT'
- s.email = ["tanel.suurhans@perfectline.co", "tarmo.lehtpuu@perfectline.co", "vladimir.krylov@perfectline.co"]
+ s.email = ['tanel.suurhans@perfectline.co', 'tarmo.lehtpuu@perfectline.co', 'vladimir.krylov@perfectline.co']
s.extra_rdoc_files = [
- "LICENSE.md",
- "README.md"
+ 'LICENSE.md',
+ 'README.md'
]
s.files = [
- "init.rb",
- "install.rb",
- "lib/locale/de.yml",
- "lib/locale/en.yml",
- "lib/locale/it.yml",
- "lib/locale/ja.yml",
- "lib/locale/pt-BR.yml",
- "lib/locale/tr.yml",
- "lib/validate_url.rb"
+ 'init.rb',
+ 'install.rb',
+ 'lib/locale/de.yml',
+ 'lib/locale/en.yml',
+ 'lib/locale/it.yml',
+ 'lib/locale/ja.yml',
+ 'lib/locale/pt-BR.yml',
+ 'lib/locale/tr.yml',
+ 'lib/validate_url.rb'
]
- s.homepage = "http://github.com/perfectline/validates_url/tree/master"
- s.rubygems_version = "2.4.5"
- s.summary = "Library for validating urls in Rails."
+ s.homepage = 'http://github.com/perfectline/validates_url/tree/master'
+ s.rubygems_version = '2.4.5'
+ s.summary = 'Library for validating urls in Rails.'
- s.add_runtime_dependency(%q, [">= 3.0.0"])
- s.add_runtime_dependency(%q, [">= 0"])
- s.add_runtime_dependency(%q, ["~> 2.x.x"])
- s.add_development_dependency(%q, [">= 3.0.0"])
- s.add_development_dependency(%q, [">= 1.1.2"])
- s.add_development_dependency(%q)
- s.add_development_dependency(%q)
- s.add_development_dependency(%q)
- s.add_development_dependency(%q)
+ s.add_runtime_dependency('activemodel', ['>= 3.0.0'])
+ s.add_runtime_dependency('addressable', ['>= 0'])
+ s.add_runtime_dependency('public_suffix', ['~> 4.0.0'])
+ s.add_development_dependency('activerecord')
+ s.add_development_dependency('diff-lcs', ['>= 1.1.2'])
+ s.add_development_dependency('jeweler')
+ s.add_development_dependency('rake')
+ s.add_development_dependency('rspec', ['>= 3.0.0'])
+ s.add_development_dependency('sqlite3')
end
From 3a32460e11658f43f7dfd62ebaae06214cb5f65d Mon Sep 17 00:00:00 2001
From: Piotr Stefanski
Date: Fri, 7 Feb 2025 13:55:32 +0100
Subject: [PATCH 02/12] [PEDSP-15739] Bump public-suffix gem
---
Gemfile.lock | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index eaa984f..4ea7416 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,10 +1,10 @@
PATH
remote: .
specs:
- validate_url (1.0.3)
+ validate_url (1.0.4)
activemodel (>= 3.0.0)
addressable
- public_suffix (~> 2.x.x)
+ public_suffix (~> 4.0.0)
GEM
remote: https://rubygems.org/
@@ -20,8 +20,8 @@ GEM
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
- addressable (2.5.2)
- public_suffix (>= 2.0.2, < 4.0)
+ addressable (2.8.7)
+ public_suffix (>= 2.0.2, < 5.0)
arel (9.0.0)
builder (3.2.3)
concurrent-ruby (1.1.3)
@@ -31,37 +31,38 @@ GEM
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
git (1.5.0)
- github_api (0.11.3)
- addressable (~> 2.3)
- descendants_tracker (~> 0.0.1)
+ github_api (0.16.0)
+ addressable (~> 2.4)
+ descendants_tracker (~> 0.0.4)
faraday (~> 0.8, < 0.10)
- hashie (>= 1.2)
- multi_json (>= 1.7.5, < 2.0)
- nokogiri (~> 1.6.0)
- oauth2
+ hashie (>= 3.4)
+ mime-types (>= 1.16, < 3.0)
+ oauth2 (~> 1.0)
hashie (3.6.0)
highline (2.0.0)
i18n (1.2.0)
concurrent-ruby (~> 1.0)
- jeweler (2.3.5)
+ jeweler (2.3.9)
builder
- bundler (>= 1.0)
+ bundler
git (>= 1.2.5)
- github_api (~> 0.11.0)
+ github_api (~> 0.16.0)
highline (>= 1.6.15)
nokogiri (>= 1.5.10)
- psych (~> 2.2)
+ psych
rake
rdoc
semver2
jwt (2.1.0)
- mini_portile2 (2.1.0)
+ mime-types (2.99.3)
+ mini_portile2 (2.8.8)
minitest (5.11.3)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
- nokogiri (1.6.8.1)
- mini_portile2 (~> 2.1.0)
+ nokogiri (1.15.7)
+ mini_portile2 (~> 2.8.2)
+ racc (~> 1.4)
oauth2 (1.4.1)
faraday (>= 0.8, < 0.16.0)
jwt (>= 1.0, < 3.0)
@@ -69,7 +70,8 @@ GEM
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
psych (2.2.4)
- public_suffix (2.0.5)
+ public_suffix (4.0.7)
+ racc (1.8.1)
rack (2.2.8)
rake (12.3.0)
rdoc (6.0.4)
From 31ad7f9464f7f3a1e7d2256ef602782fc2b70fa3 Mon Sep 17 00:00:00 2001
From: Piotr Stefanski
Date: Fri, 7 Feb 2025 13:57:35 +0100
Subject: [PATCH 03/12] [PEDSP-15739] Bump public-suffix gem
---
Gemfile.lock | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 4ea7416..3f9e139 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -107,4 +107,4 @@ DEPENDENCIES
validate_url!
BUNDLED WITH
- 1.17.1
+ 2.4.15
From e5c8251aa1f8b2e271a04643cff783aff1a55c82 Mon Sep 17 00:00:00 2001
From: Piotr Stefanski
Date: Fri, 7 Feb 2025 13:59:19 +0100
Subject: [PATCH 04/12] [PEDSP-15739] Bump public-suffix gem
---
Gemfile.lock | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 3f9e139..f5b5ad1 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -21,7 +21,7 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.8.7)
- public_suffix (>= 2.0.2, < 5.0)
+ public_suffix (>= 2.0.2, < 7.0)
arel (9.0.0)
builder (3.2.3)
concurrent-ruby (1.1.3)
From 3f514b36bca1c9350e377e739b3df24dc0d2c35f Mon Sep 17 00:00:00 2001
From: Piotr Stefanski
Date: Fri, 7 Feb 2025 14:00:26 +0100
Subject: [PATCH 05/12] [PEDSP-15739] Bump public-suffix gem
---
Gemfile.lock | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index f5b5ad1..fd3081a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -20,9 +20,9 @@ GEM
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
- addressable (2.8.7)
- public_suffix (>= 2.0.2, < 7.0)
+ addressable (2.4.0)
arel (9.0.0)
+ base64 (0.2.0)
builder (3.2.3)
concurrent-ruby (1.1.3)
descendants_tracker (0.0.4)
@@ -32,13 +32,13 @@ GEM
multipart-post (>= 1.2, < 3)
git (1.5.0)
github_api (0.16.0)
- addressable (~> 2.4)
+ addressable (~> 2.4.0)
descendants_tracker (~> 0.0.4)
faraday (~> 0.8, < 0.10)
hashie (>= 3.4)
mime-types (>= 1.16, < 3.0)
oauth2 (~> 1.0)
- hashie (3.6.0)
+ hashie (5.0.0)
highline (2.0.0)
i18n (1.2.0)
concurrent-ruby (~> 1.0)
@@ -53,18 +53,19 @@ GEM
rake
rdoc
semver2
- jwt (2.1.0)
+ jwt (2.10.1)
+ base64
mime-types (2.99.3)
mini_portile2 (2.8.8)
minitest (5.11.3)
- multi_json (1.13.1)
+ multi_json (1.15.0)
multi_xml (0.6.0)
- multipart-post (2.0.0)
+ multipart-post (2.4.1)
nokogiri (1.15.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
- oauth2 (1.4.1)
- faraday (>= 0.8, < 0.16.0)
+ oauth2 (1.4.8)
+ faraday (>= 0.8, < 3.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
@@ -72,7 +73,7 @@ GEM
psych (2.2.4)
public_suffix (4.0.7)
racc (1.8.1)
- rack (2.2.8)
+ rack (2.2.10)
rake (12.3.0)
rdoc (6.0.4)
rspec (3.8.0)
From 94cc36f461ce07e845c71ea7d03dccb14abe3bb0 Mon Sep 17 00:00:00 2001
From: Piotr Stefanski
Date: Fri, 7 Feb 2025 14:04:48 +0100
Subject: [PATCH 06/12] [PEDSP-15739] Bump public-suffix gem
---
Gemfile.lock | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index fd3081a..e343c59 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -90,7 +90,7 @@ GEM
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
semver2 (3.4.2)
- sqlite3 (1.3.13)
+ sqlite3 (1.6.9)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
From 50527c573165bf5a5de4f99fba9e64d947f87161 Mon Sep 17 00:00:00 2001
From: Piotr Stefanski
Date: Fri, 7 Feb 2025 14:09:17 +0100
Subject: [PATCH 07/12] [PEDSP-15739] Bump public-suffix gem
---
Gemfile.lock | 47 +++++++++++++++++++++++++++++++----------------
1 file changed, 31 insertions(+), 16 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index e343c59..3d305ee 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -9,25 +9,36 @@ PATH
GEM
remote: https://rubygems.org/
specs:
- activemodel (5.2.2)
- activesupport (= 5.2.2)
- activerecord (5.2.2)
- activemodel (= 5.2.2)
- activesupport (= 5.2.2)
- arel (>= 9.0)
- activesupport (5.2.2)
+ activemodel (7.1.5.1)
+ activesupport (= 7.1.5.1)
+ activerecord (7.1.5.1)
+ activemodel (= 7.1.5.1)
+ activesupport (= 7.1.5.1)
+ timeout (>= 0.4.0)
+ activesupport (7.1.5.1)
+ base64
+ benchmark (>= 0.3)
+ bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
- i18n (>= 0.7, < 2)
- minitest (~> 5.1)
- tzinfo (~> 1.1)
+ connection_pool (>= 2.2.5)
+ drb
+ i18n (>= 1.6, < 2)
+ logger (>= 1.4.2)
+ minitest (>= 5.1)
+ mutex_m
+ securerandom (>= 0.3)
+ tzinfo (~> 2.0)
addressable (2.4.0)
- arel (9.0.0)
base64 (0.2.0)
+ benchmark (0.4.0)
+ bigdecimal (3.1.9)
builder (3.2.3)
- concurrent-ruby (1.1.3)
+ concurrent-ruby (1.3.5)
+ connection_pool (2.5.0)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
diff-lcs (1.3)
+ drb (2.2.1)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
git (1.5.0)
@@ -40,7 +51,7 @@ GEM
oauth2 (~> 1.0)
hashie (5.0.0)
highline (2.0.0)
- i18n (1.2.0)
+ i18n (1.14.7)
concurrent-ruby (~> 1.0)
jeweler (2.3.9)
builder
@@ -55,12 +66,14 @@ GEM
semver2
jwt (2.10.1)
base64
+ logger (1.6.5)
mime-types (2.99.3)
mini_portile2 (2.8.8)
- minitest (5.11.3)
+ minitest (5.25.4)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.4.1)
+ mutex_m (0.3.0)
nokogiri (1.15.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
@@ -89,11 +102,13 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
+ securerandom (0.3.2)
semver2 (3.4.2)
sqlite3 (1.6.9)
thread_safe (0.3.6)
- tzinfo (1.2.5)
- thread_safe (~> 0.1)
+ timeout (0.4.3)
+ tzinfo (2.0.6)
+ concurrent-ruby (~> 1.0)
PLATFORMS
ruby
From 31a2e30f1dff5e6a14578821742424b7af3e3a79 Mon Sep 17 00:00:00 2001
From: Piotr Stefanski
Date: Fri, 7 Feb 2025 14:16:56 +0100
Subject: [PATCH 08/12] [PEDSP-15739] Bump public-suffix gem
---
Gemfile.lock | 35 ++++++++++-------------------------
validate_url.gemspec | 2 +-
2 files changed, 11 insertions(+), 26 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 3d305ee..2f45f43 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -2,43 +2,31 @@ PATH
remote: .
specs:
validate_url (1.0.4)
- activemodel (>= 3.0.0)
+ activemodel (>= 3.0.0, < 7.0)
addressable
public_suffix (~> 4.0.0)
GEM
remote: https://rubygems.org/
specs:
- activemodel (7.1.5.1)
- activesupport (= 7.1.5.1)
- activerecord (7.1.5.1)
- activemodel (= 7.1.5.1)
- activesupport (= 7.1.5.1)
- timeout (>= 0.4.0)
- activesupport (7.1.5.1)
- base64
- benchmark (>= 0.3)
- bigdecimal
+ activemodel (6.1.7.10)
+ activesupport (= 6.1.7.10)
+ activerecord (6.1.7.10)
+ activemodel (= 6.1.7.10)
+ activesupport (= 6.1.7.10)
+ activesupport (6.1.7.10)
concurrent-ruby (~> 1.0, >= 1.0.2)
- connection_pool (>= 2.2.5)
- drb
i18n (>= 1.6, < 2)
- logger (>= 1.4.2)
minitest (>= 5.1)
- mutex_m
- securerandom (>= 0.3)
tzinfo (~> 2.0)
+ zeitwerk (~> 2.3)
addressable (2.4.0)
base64 (0.2.0)
- benchmark (0.4.0)
- bigdecimal (3.1.9)
- builder (3.2.3)
+ builder (3.3.0)
concurrent-ruby (1.3.5)
- connection_pool (2.5.0)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
diff-lcs (1.3)
- drb (2.2.1)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
git (1.5.0)
@@ -66,14 +54,12 @@ GEM
semver2
jwt (2.10.1)
base64
- logger (1.6.5)
mime-types (2.99.3)
mini_portile2 (2.8.8)
minitest (5.25.4)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.4.1)
- mutex_m (0.3.0)
nokogiri (1.15.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
@@ -102,13 +88,12 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
- securerandom (0.3.2)
semver2 (3.4.2)
sqlite3 (1.6.9)
thread_safe (0.3.6)
- timeout (0.4.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
+ zeitwerk (2.6.18)
PLATFORMS
ruby
diff --git a/validate_url.gemspec b/validate_url.gemspec
index 6152e2f..195b8bd 100644
--- a/validate_url.gemspec
+++ b/validate_url.gemspec
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
s.rubygems_version = '2.4.5'
s.summary = 'Library for validating urls in Rails.'
- s.add_runtime_dependency('activemodel', ['>= 3.0.0'])
+ s.add_runtime_dependency('activemodel', ['>= 3.0.0', '< 7.0'])
s.add_runtime_dependency('addressable', ['>= 0'])
s.add_runtime_dependency('public_suffix', ['~> 4.0.0'])
s.add_development_dependency('activerecord')
From bd07899a6e5ed8013b7f73c35859030f0128049d Mon Sep 17 00:00:00 2001
From: Piotr Stefanski
Date: Fri, 7 Feb 2025 14:29:35 +0100
Subject: [PATCH 09/12] [PEDSP-15739] Bump public-suffix gem
---
Gemfile.lock | 30 ++++++++++++++----------------
lib/validate_url.rb | 21 +++++++++++----------
spec/spec_helper.rb | 4 ++--
validate_url.gemspec | 7 ++++---
4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 2f45f43..d7c2fa4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -20,41 +20,39 @@ GEM
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
- addressable (2.4.0)
+ addressable (2.8.7)
+ public_suffix (>= 2.0.2, < 7.0)
base64 (0.2.0)
builder (3.3.0)
- concurrent-ruby (1.3.5)
+ concurrent-ruby (1.3.4)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
diff-lcs (1.3)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
git (1.5.0)
- github_api (0.16.0)
- addressable (~> 2.4.0)
+ github_api (0.18.1)
+ addressable (~> 2.4)
descendants_tracker (~> 0.0.4)
- faraday (~> 0.8, < 0.10)
+ faraday (~> 0.8)
hashie (>= 3.4)
- mime-types (>= 1.16, < 3.0)
oauth2 (~> 1.0)
hashie (5.0.0)
highline (2.0.0)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
- jeweler (2.3.9)
+ jeweler (2.1.1)
builder
- bundler
+ bundler (>= 1.0)
git (>= 1.2.5)
- github_api (~> 0.16.0)
+ github_api
highline (>= 1.6.15)
nokogiri (>= 1.5.10)
- psych
rake
rdoc
- semver2
+ semver
jwt (2.10.1)
base64
- mime-types (2.99.3)
mini_portile2 (2.8.8)
minitest (5.25.4)
multi_json (1.15.0)
@@ -69,7 +67,6 @@ GEM
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
- psych (2.2.4)
public_suffix (4.0.7)
racc (1.8.1)
rack (2.2.10)
@@ -88,7 +85,7 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
- semver2 (3.4.2)
+ semver (1.0.1)
sqlite3 (1.6.9)
thread_safe (0.3.6)
tzinfo (2.0.6)
@@ -99,12 +96,13 @@ PLATFORMS
ruby
DEPENDENCIES
- activerecord
+ activerecord (< 7.0)
+ concurrent-ruby (= 1.3.4)
diff-lcs (>= 1.1.2)
jeweler
rake
rspec (>= 3.0.0)
- sqlite3
+ sqlite3 (= 1.6.9)
validate_url!
BUNDLED WITH
diff --git a/lib/validate_url.rb b/lib/validate_url.rb
index 075b3bc..82b4579 100644
--- a/lib/validate_url.rb
+++ b/lib/validate_url.rb
@@ -2,16 +2,16 @@
require 'active_model'
require 'active_support/i18n'
require 'public_suffix'
-I18n.load_path += Dir[File.dirname(__FILE__) + "/locale/*.yml"]
+I18n.load_path += Dir[File.dirname(__FILE__) + '/locale/*.yml']
module ActiveModel
module Validations
class UrlValidator < ActiveModel::EachValidator
def initialize(options)
- options.reverse_merge!(:schemes => %w(http https))
- options.reverse_merge!(:no_local => false)
- options.reverse_merge!(:public_suffix => false)
- options.reverse_merge!(:no_pre_query => false)
+ options.reverse_merge!(schemes: %w[http https])
+ options.reverse_merge!(no_local: false)
+ options.reverse_merge!(public_suffix: false)
+ options.reverse_merge!(no_pre_query: false)
super(options)
end
@@ -33,9 +33,10 @@ def validate_each(record, attribute, value)
add_error(options.fetch(:message, :url_host)) unless validate_host_presence(uri)
add_error(options.fetch(:message, :url_suffix)) unless validate_suffix(uri, public_suffix)
add_error(options.fetch(:message, :url_suffix)) unless validate_no_local(uri, no_local)
- add_error(*options.fetch(:message, [:url_scheme, :schemes => schemes.join(', ')])) unless validate_scheme_presence(uri, schemes)
+ unless validate_scheme_presence(uri, schemes)
+ add_error(*options.fetch(:message, [:url_scheme, schemes: schemes.join(', ')]))
+ end
add_error(options.fetch(:message, :url_path)) unless validate_pre_query(uri, no_pre_query)
-
rescue Addressable::URI::InvalidURIError
add_error(options.fetch(:message, :url))
end
@@ -43,6 +44,7 @@ def validate_each(record, attribute, value)
def add_error(*message)
return if @errors.include?(message)
+
@record.errors.add(@attribute, *message)
@errors << message
end
@@ -52,7 +54,7 @@ def validate_host_presence(uri)
end
def validate_suffix(uri, public_suffix)
- !public_suffix || (PublicSuffix.valid?(uri.host, :default_rule => nil))
+ !public_suffix || PublicSuffix.valid?(uri.host, default_rule: nil)
end
def validate_no_local(uri, no_local)
@@ -65,9 +67,8 @@ def validate_scheme_presence(uri, schemes)
def validate_pre_query(uri, no_pre_query)
# URLs with queries should have a '/' before the '?'.
- no_pre_query || uri.query.nil? || uri.path&.starts_with?('/')
+ no_pre_query || uri.query.nil? || uri.path&.start_with?('/')
end
-
end
module ClassMethods
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index daec130..7be454c 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -10,8 +10,8 @@
ActiveRecord::Migration.verbose = false
ActiveRecord::Base.establish_connection(
- "adapter" => "sqlite3",
- "database" => ":memory:"
+ 'adapter' => 'sqlite3',
+ 'database' => ':memory:'
)
require File.join(File.dirname(__FILE__), '..', 'init')
diff --git a/validate_url.gemspec b/validate_url.gemspec
index 195b8bd..fe3f10c 100644
--- a/validate_url.gemspec
+++ b/validate_url.gemspec
@@ -36,12 +36,13 @@ Gem::Specification.new do |s|
s.summary = 'Library for validating urls in Rails.'
s.add_runtime_dependency('activemodel', ['>= 3.0.0', '< 7.0'])
- s.add_runtime_dependency('addressable', ['>= 0'])
+ s.add_runtime_dependency('addressable')
s.add_runtime_dependency('public_suffix', ['~> 4.0.0'])
- s.add_development_dependency('activerecord')
+ s.add_development_dependency('activerecord', ['< 7.0'])
+ s.add_development_dependency('concurrent-ruby', ['= 1.3.4'])
s.add_development_dependency('diff-lcs', ['>= 1.1.2'])
s.add_development_dependency('jeweler')
s.add_development_dependency('rake')
s.add_development_dependency('rspec', ['>= 3.0.0'])
- s.add_development_dependency('sqlite3')
+ s.add_development_dependency('sqlite3', ['= 1.6.9'])
end
From 8d9a1f7851905d7a17f361cd457bfd433d91c84f Mon Sep 17 00:00:00 2001
From: Piotr Stefanski
Date: Tue, 11 Feb 2025 15:02:07 +0100
Subject: [PATCH 10/12] tests and rubocop
---
lib/validate_url.rb | 4 +-
spec/resources/user.rb | 2 +-
spec/resources/user_with_ar.rb | 4 +-
spec/resources/user_with_ar_legacy.rb | 2 +-
spec/resources/user_with_blank.rb | 2 +-
spec/resources/user_with_custom_message.rb | 2 +-
spec/resources/user_with_custom_scheme.rb | 2 +-
spec/resources/user_with_legacy_syntax.rb | 2 +-
spec/resources/user_with_nil.rb | 2 +-
spec/resources/user_with_no_local.rb | 4 +-
spec/resources/user_with_no_pre_query.rb | 2 +-
spec/resources/user_with_public_suffix.rb | 2 +-
spec/validate_url_spec.rb | 184 ++++++++++-----------
13 files changed, 106 insertions(+), 108 deletions(-)
diff --git a/lib/validate_url.rb b/lib/validate_url.rb
index 82b4579..ff4841f 100644
--- a/lib/validate_url.rb
+++ b/lib/validate_url.rb
@@ -45,7 +45,9 @@ def validate_each(record, attribute, value)
def add_error(*message)
return if @errors.include?(message)
- @record.errors.add(@attribute, *message)
+ arg = message.slice(0)
+ kwargs = message.slice(1) || {}
+ @record.errors.add(@attribute, arg, **kwargs)
@errors << message
end
diff --git a/spec/resources/user.rb b/spec/resources/user.rb
index 30b4c04..3d9edfa 100644
--- a/spec/resources/user.rb
+++ b/spec/resources/user.rb
@@ -3,5 +3,5 @@ class User
attr_accessor :homepage
- validates :homepage, :url => true
+ validates :homepage, url: true
end
diff --git a/spec/resources/user_with_ar.rb b/spec/resources/user_with_ar.rb
index 28b7c8a..4aa754a 100644
--- a/spec/resources/user_with_ar.rb
+++ b/spec/resources/user_with_ar.rb
@@ -1,5 +1,5 @@
class UserWithAr < ActiveRecord::Base
- self.table_name = "users"
+ self.table_name = 'users'
- validates :homepage, :url => true
+ validates :homepage, url: true
end
diff --git a/spec/resources/user_with_ar_legacy.rb b/spec/resources/user_with_ar_legacy.rb
index e970800..2298811 100644
--- a/spec/resources/user_with_ar_legacy.rb
+++ b/spec/resources/user_with_ar_legacy.rb
@@ -1,5 +1,5 @@
class UserWithArLegacy < ActiveRecord::Base
- self.table_name = "users"
+ self.table_name = 'users'
validates_url :homepage
end
diff --git a/spec/resources/user_with_blank.rb b/spec/resources/user_with_blank.rb
index a8363d9..6af6b11 100644
--- a/spec/resources/user_with_blank.rb
+++ b/spec/resources/user_with_blank.rb
@@ -5,5 +5,5 @@ class UserWithBlank
attr_accessor :homepage
- validates :homepage, :url => {:allow_blank => true}
+ validates :homepage, url: { allow_blank: true }
end
diff --git a/spec/resources/user_with_custom_message.rb b/spec/resources/user_with_custom_message.rb
index b17bc55..e7fc789 100644
--- a/spec/resources/user_with_custom_message.rb
+++ b/spec/resources/user_with_custom_message.rb
@@ -3,5 +3,5 @@ class UserWithCustomMessage
attr_accessor :homepage
- validates :homepage, :url => {message: "wrong"}
+ validates :homepage, url: { message: 'wrong' }
end
diff --git a/spec/resources/user_with_custom_scheme.rb b/spec/resources/user_with_custom_scheme.rb
index 9c56d23..cc0b475 100644
--- a/spec/resources/user_with_custom_scheme.rb
+++ b/spec/resources/user_with_custom_scheme.rb
@@ -3,5 +3,5 @@ class UserWithCustomScheme
attr_accessor :homepage
- validates :homepage, :url => { :schemes => ['ftp'] }
+ validates :homepage, url: { schemes: ['ftp'] }
end
diff --git a/spec/resources/user_with_legacy_syntax.rb b/spec/resources/user_with_legacy_syntax.rb
index 06e77b4..d76c089 100644
--- a/spec/resources/user_with_legacy_syntax.rb
+++ b/spec/resources/user_with_legacy_syntax.rb
@@ -5,5 +5,5 @@ class UserWithLegacySyntax
attr_accessor :homepage
- validates_url :homepage, :allow_blank => true
+ validates_url :homepage, allow_blank: true
end
diff --git a/spec/resources/user_with_nil.rb b/spec/resources/user_with_nil.rb
index fa033b9..45336cf 100644
--- a/spec/resources/user_with_nil.rb
+++ b/spec/resources/user_with_nil.rb
@@ -5,5 +5,5 @@ class UserWithNil
attr_accessor :homepage
- validates :homepage, :url => {:allow_nil => true}
+ validates :homepage, url: { allow_nil: true }
end
diff --git a/spec/resources/user_with_no_local.rb b/spec/resources/user_with_no_local.rb
index 2e302e3..f93a9ec 100644
--- a/spec/resources/user_with_no_local.rb
+++ b/spec/resources/user_with_no_local.rb
@@ -5,5 +5,5 @@ class UserWithNoLocal
attr_accessor :homepage
- validates :homepage, :url => {:no_local => true}
-end
\ No newline at end of file
+ validates :homepage, url: { no_local: true }
+end
diff --git a/spec/resources/user_with_no_pre_query.rb b/spec/resources/user_with_no_pre_query.rb
index fc534cb..a30551d 100644
--- a/spec/resources/user_with_no_pre_query.rb
+++ b/spec/resources/user_with_no_pre_query.rb
@@ -5,5 +5,5 @@ class UserWithNoPreQuery
attr_accessor :homepage
- validates :homepage, :url => {:no_pre_query => true}
+ validates :homepage, url: { no_pre_query: true }
end
diff --git a/spec/resources/user_with_public_suffix.rb b/spec/resources/user_with_public_suffix.rb
index df90023..182f586 100644
--- a/spec/resources/user_with_public_suffix.rb
+++ b/spec/resources/user_with_public_suffix.rb
@@ -5,5 +5,5 @@ class UserWithPublicSuffix
attr_accessor :homepage
- validates :homepage, :url => {:public_suffix => true}
+ validates :homepage, url: { public_suffix: true }
end
diff --git a/spec/validate_url_spec.rb b/spec/validate_url_spec.rb
index 0886d01..4aa687b 100644
--- a/spec/validate_url_spec.rb
+++ b/spec/validate_url_spec.rb
@@ -1,15 +1,11 @@
-# encoding: utf-8
require 'spec_helper'
-describe "URL validation" do
-
+describe 'URL validation' do
before(:all) do
- ActiveRecord::Schema.define(:version => 1) do
-
- create_table :users, :force => true do |t|
+ ActiveRecord::Schema.define(version: 1) do
+ create_table :users, force: true do |t|
t.column :homepage, :string
end
-
end
end
@@ -17,259 +13,259 @@
ActiveRecord::Base.connection.drop_table(:users)
end
- context "with regular validator" do
+ context 'with regular validator' do
before do
@user = User.new
end
- it "should not allow nil as url" do
+ it 'does not allow nil as url' do
@user.homepage = nil
expect(@user).not_to be_valid
end
- it "should not allow blank as url" do
- @user.homepage = ""
+ it 'does not allow blank as url' do
+ @user.homepage = ''
expect(@user).not_to be_valid
end
- it "should not allow an url without scheme" do
- @user.homepage = "www.example.com"
+ it 'does not allow an url without scheme' do
+ @user.homepage = 'www.example.com'
expect(@user).not_to be_valid
end
- it "should allow an url with http" do
- @user.homepage = "http://localhost"
+ it 'allows an url with http' do
+ @user.homepage = 'http://localhost'
expect(@user).to be_valid
end
- it "should allow an url with https" do
- @user.homepage = "https://localhost"
+ it 'allows an url with https' do
+ @user.homepage = 'https://localhost'
expect(@user).to be_valid
end
- it "should not allow a url with an invalid scheme" do
- @user.homepage = "ftp://localhost"
+ it 'does not allow a url with an invalid scheme' do
+ @user.homepage = 'ftp://localhost'
expect(@user).not_to be_valid
end
- it "should not allow a url with only a scheme" do
- @user.homepage = "http://"
+ it 'does not allow a url with only a scheme' do
+ @user.homepage = 'http://'
expect(@user).not_to be_valid
end
- it "should not allow a url without a host" do
- @user.homepage = "http:/"
+ it 'does not allow a url without a host' do
+ @user.homepage = 'http:/'
expect(@user).not_to be_valid
end
- it "should allow a url with an underscore" do
- @user.homepage = "http://foo_bar.com"
+ it 'allows a url with an underscore' do
+ @user.homepage = 'http://foo_bar.com'
expect(@user).to be_valid
end
- it "should allow a url with query only if it has a path" do
- @user.homepage = "http://foo_bar.com/?"
+ it 'allows a url with query only if it has a path' do
+ @user.homepage = 'http://foo_bar.com/?'
expect(@user).to be_valid
- @user.homepage = "http://foo_bar.com/?a=b"
+ @user.homepage = 'http://foo_bar.com/?a=b'
expect(@user).to be_valid
- @user.homepage = "http://foo_bar.com?a=b"
+ @user.homepage = 'http://foo_bar.com?a=b'
expect(@user).not_to be_valid
end
- it "should not allow a url with no host but a query" do
- @user.homepage = "http:///?a=b"
- expect(@user).not_to be_valid
- @user.homepage = "http://?"
- expect(@user).not_to be_valid
+ it 'does not allow a url with no host but a query' do
+ @user.homepage = 'http:///?a=b'
+ expect(@user).not_to be_valid
+ @user.homepage = 'http://?'
+ expect(@user).not_to be_valid
end
- it "should return multiple error messages" do
- @user.homepage = "invalid"
- error_message = ["requires valid host", "requires scheme in: http, https"]
+ it 'returns multiple error messages' do
+ @user.homepage = 'invalid'
+ error_message = ['requires valid host', 'requires scheme in: http, https']
expect(@user).not_to be_valid
expect(@user.errors[:homepage]).to eq(error_message)
end
-
end
- context "with allow nil" do
+ context 'with allow nil' do
before do
@user = UserWithNil.new
end
- it "should allow nil as url" do
+ it 'allows nil as url' do
@user.homepage = nil
expect(@user).to be_valid
end
- it "should not allow blank as url" do
- @user.homepage = ""
+ it 'does not allow blank as url' do
+ @user.homepage = ''
expect(@user).not_to be_valid
end
- it "should allow a valid url" do
- @user.homepage = "http://www.example.com"
+ it 'allows a valid url' do
+ @user.homepage = 'http://www.example.com'
expect(@user).to be_valid
end
- it "should allow a url with an underscore" do
- @user.homepage = "http://foo_bar.com"
+ it 'allows a url with an underscore' do
+ @user.homepage = 'http://foo_bar.com'
expect(@user).to be_valid
end
end
- context "with allow blank" do
+ context 'with allow blank' do
before do
@user = UserWithBlank.new
end
- it "should allow nil as url" do
+ it 'allows nil as url' do
@user.homepage = nil
expect(@user).to be_valid
end
- it "should allow blank as url" do
- @user.homepage = ""
+ it 'allows blank as url' do
+ @user.homepage = ''
expect(@user).to be_valid
end
- it "should allow a valid url" do
- @user.homepage = "http://www.example.com"
+ it 'allows a valid url' do
+ @user.homepage = 'http://www.example.com'
expect(@user).to be_valid
end
- it "should allow a url with an underscore" do
- @user.homepage = "http://foo_bar.com"
+ it 'allows a url with an underscore' do
+ @user.homepage = 'http://foo_bar.com'
expect(@user).to be_valid
end
end
- context "with no_local" do
+ context 'with no_local' do
before do
@user = UserWithNoLocal.new
end
- it "should allow a valid internet url" do
- @user.homepage = "http://www.example.com"
+ it 'allows a valid internet url' do
+ @user.homepage = 'http://www.example.com'
expect(@user).to be_valid
end
- it "should not allow a local hostname" do
- @user.homepage = "http://localhost"
+ it 'does not allow a local hostname' do
+ @user.homepage = 'http://localhost'
expect(@user).not_to be_valid
end
- it "should not allow weird urls that get interpreted as local hostnames" do
- @user.homepage = "http://http://example.com"
+ it 'does not allow weird urls that get interpreted as local hostnames' do
+ @user.homepage = 'http://http://example.com'
expect(@user).not_to be_valid
end
end
- context "with no_pre_query" do
+ context 'with no_pre_query' do
before do
@user = UserWithNoPreQuery.new
end
- it "should allow a valid url with no pre query" do
- @user.homepage = "http://foo_bar?a=b"
+ it 'allows a valid url with no pre query' do
+ @user.homepage = 'http://foo_bar?a=b'
expect(@user).to be_valid
end
end
- context "with public_suffix" do
+ context 'with public_suffix' do
before do
@user = UserWithPublicSuffix.new
end
- it "should allow a valid public suffix" do
- @user.homepage = "http://www.example.com"
+ it 'allows a valid public suffix' do
+ @user.homepage = 'http://www.example.com'
@user.should be_valid
end
- it "should not allow a local hostname" do
- @user.homepage = "http://localhost"
+ it 'does not allow a local hostname' do
+ @user.homepage = 'http://localhost'
@user.should_not be_valid
end
- it "should not allow non public hosts suffixes" do
- @user.homepage = "http://example.not_a_valid_tld"
+ it 'does not allow non public hosts suffixes' do
+ @user.homepage = 'http://example.not_a_valid_tld'
@user.should_not be_valid
end
end
- context "with legacy syntax" do
+ context 'with legacy syntax' do
before do
@user = UserWithLegacySyntax.new
end
- it "should allow nil as url" do
+ it 'allows nil as url' do
@user.homepage = nil
expect(@user).to be_valid
end
- it "should allow blank as url" do
- @user.homepage = ""
+ it 'allows blank as url' do
+ @user.homepage = ''
expect(@user).to be_valid
end
- it "should allow a valid url" do
- @user.homepage = "http://www.example.com"
+ it 'allows a valid url' do
+ @user.homepage = 'http://www.example.com'
expect(@user).to be_valid
end
- it "should not allow invalid url" do
- @user.homepage = "random"
+ it 'does not allow invalid url' do
+ @user.homepage = 'random'
expect(@user).not_to be_valid
end
- it "should allow a url with an underscore" do
- @user.homepage = "http://foo_bar.com"
+ it 'allows a url with an underscore' do
+ @user.homepage = 'http://foo_bar.com'
expect(@user).to be_valid
end
end
- context "with ActiveRecord" do
+ context 'with ActiveRecord' do
before do
@user = UserWithAr.new
end
- it "should not allow invalid url" do
- @user.homepage = "random"
+ it 'does not allow invalid url' do
+ @user.homepage = 'random'
expect(@user).not_to be_valid
end
end
- context "with ActiveRecord and legacy syntax" do
+ context 'with ActiveRecord and legacy syntax' do
before do
@user = UserWithArLegacy.new
end
- it "should not allow invalid url" do
- @user.homepage = "random"
+ it 'does not allow invalid url' do
+ @user.homepage = 'random'
expect(@user).not_to be_valid
end
end
- context "with regular validator and custom scheme" do
+ context 'with regular validator and custom scheme' do
before do
@user = UserWithCustomScheme.new
end
- it "should allow alternative URI schemes" do
- @user.homepage = "ftp://ftp.example.com"
+ it 'allows alternative URI schemes' do
+ @user.homepage = 'ftp://ftp.example.com'
expect(@user).to be_valid
end
end
- context "with custom message" do
+ context 'with custom message' do
before do
@user = UserWithCustomMessage.new
end
- it "should use custom message" do
- @user.homepage = "invalid"
+ it 'uses custom message' do
+ @user.homepage = 'invalid'
@user.valid?
- expect(@user.errors[:homepage]).to eq(["wrong"])
+
+ expect(@user.errors[:homepage]).to eq(['wrong'])
end
end
end
From 6f295c437947a10dbe44a85abc9323e76301e4d2 Mon Sep 17 00:00:00 2001
From: Piotr Stefanski
Date: Tue, 11 Feb 2025 15:05:42 +0100
Subject: [PATCH 11/12] runs on
---
.github/workflows/ci.yml | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f2c9bc7..6f47341 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -6,7 +6,9 @@ on:
jobs:
test:
name: tests / ruby
- runs-on: ubuntu-latest
+ runs-on:
+ group: SelfHostedDefault
+ labels: ubuntu-22.04-small
strategy:
matrix:
ruby-version: ['2.7.8', '3.0.7']
@@ -22,7 +24,9 @@ jobs:
run: bundle exec rspec
rubocop:
name: linters / rubocop
- runs-on: ubuntu-latest
+ runs-on:
+ group: SelfHostedDefault
+ labels: ubuntu-22.04-small
env:
RUBY_VERSION: 2.7.8
RUBOCOP_VERSION: 1.41.1
From 647cc30d2bb2bf2eca643321514c79ed47576ae2 Mon Sep 17 00:00:00 2001
From: Piotr Stefanski
Date: Tue, 11 Feb 2025 15:08:08 +0100
Subject: [PATCH 12/12] Revert "runs on"
This reverts commit 6f295c437947a10dbe44a85abc9323e76301e4d2.
---
.github/workflows/ci.yml | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6f47341..f2c9bc7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -6,9 +6,7 @@ on:
jobs:
test:
name: tests / ruby
- runs-on:
- group: SelfHostedDefault
- labels: ubuntu-22.04-small
+ runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.7.8', '3.0.7']
@@ -24,9 +22,7 @@ jobs:
run: bundle exec rspec
rubocop:
name: linters / rubocop
- runs-on:
- group: SelfHostedDefault
- labels: ubuntu-22.04-small
+ runs-on: ubuntu-latest
env:
RUBY_VERSION: 2.7.8
RUBOCOP_VERSION: 1.41.1