validate_url 1.0.8 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +29 -1
- data/lib/locale/ja.yml +1 -1
- data/lib/validate_url.rb +5 -5
- data/lib/{rspec_matcher.rb → validate_url/rspec_matcher.rb} +0 -0
- metadata +18 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 70a15c71f5f41103a97ef5aad221018601dd24584210b10fe4b079f96fcc9fb0
|
4
|
+
data.tar.gz: 66c06e4b38d8d084c6adccc6060fa1b950bff8874e6c2eeaf53270c012d7b566
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acda957026f81ebcd4df320d46522244c48db058c1bef71accc70d85d9e852523ac8a477ad3b1983b4899a241e18d07c79e26c6e3c8bd923d588eec4dd8fc912
|
7
|
+
data.tar.gz: 0a9663a190ec81682eecf389b034bb9c29db606349cdc2a65584e868fab2b390166485161e8e1f80224ea5d1fc99a404264e3d24022697e0022c0e39378cfcc0
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ This gem adds the capability of validating URLs to ActiveRecord and ActiveModel.
|
|
8
8
|
# add this to your Gemfile
|
9
9
|
gem "validate_url"
|
10
10
|
|
11
|
-
#
|
11
|
+
# or run
|
12
12
|
sudo gem install validate_url
|
13
13
|
```
|
14
14
|
|
@@ -51,6 +51,22 @@ class Unicorn
|
|
51
51
|
end
|
52
52
|
```
|
53
53
|
|
54
|
+
### With RSpec
|
55
|
+
|
56
|
+
Require the matcher in `spec_helper.rb` or `rails_helper.rb`:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
require 'validate_url/rspec_matcher'
|
60
|
+
```
|
61
|
+
|
62
|
+
In your spec:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
describe Unicorn
|
66
|
+
it { is_expected.to validate_url_of(:homepage) }
|
67
|
+
end
|
68
|
+
```
|
69
|
+
|
54
70
|
### I18n
|
55
71
|
|
56
72
|
The default error message `is not a valid URL`.
|
@@ -70,3 +86,15 @@ Validates URL is created and maintained by [PerfectLine](http://www.perfectline.
|
|
70
86
|
|
71
87
|
Validates URL is Copyright © 2010-2014 [PerfectLine](http://www.perfectline.co), LLC. It is free software, and may be
|
72
88
|
redistributed under the terms specified in the LICENSE file.
|
89
|
+
|
90
|
+
## How to push new version
|
91
|
+
|
92
|
+
```
|
93
|
+
rake version:bump:patch
|
94
|
+
rake gemspec
|
95
|
+
```
|
96
|
+
Fix validate_url.gemspec to remove unneeded wrong strings
|
97
|
+
```
|
98
|
+
gem build validate_url.gemspec
|
99
|
+
gem push validate_url-1.0.8.gem
|
100
|
+
```
|
data/lib/locale/ja.yml
CHANGED
data/lib/validate_url.rb
CHANGED
@@ -20,16 +20,16 @@ module ActiveModel
|
|
20
20
|
def validate_each(record, attribute, value)
|
21
21
|
schemes = [*options.fetch(:schemes)].map(&:to_s)
|
22
22
|
begin
|
23
|
-
|
24
|
-
uri = URI.parse(escaped_uri)
|
23
|
+
uri = URI.parse(value)
|
25
24
|
host = uri && uri.host
|
26
25
|
scheme = uri && uri.scheme
|
27
26
|
|
28
|
-
|
29
|
-
valid_no_local = !options.fetch(:no_local) || (host && host.include?('.'))
|
27
|
+
valid_raw_url = scheme && value =~ /\A#{URI::regexp([scheme])}\z/
|
30
28
|
valid_scheme = host && scheme && schemes.include?(scheme)
|
29
|
+
valid_no_local = !options.fetch(:no_local) || (host && host.include?('.'))
|
30
|
+
valid_suffix = !options.fetch(:public_suffix) || (host && PublicSuffix.valid?(host, :default_rule => nil))
|
31
31
|
|
32
|
-
unless valid_scheme && valid_no_local && valid_suffix
|
32
|
+
unless valid_raw_url && valid_scheme && valid_no_local && valid_suffix
|
33
33
|
record.errors.add(attribute, options.fetch(:message), value: value)
|
34
34
|
end
|
35
35
|
rescue URI::InvalidURIError
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validate_url
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanel Suurhans
|
@@ -10,8 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-05-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: validate_url
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: jeweler
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,8 +152,8 @@ files:
|
|
138
152
|
- lib/locale/tr.yml
|
139
153
|
- lib/locale/zh-CN.yml
|
140
154
|
- lib/locale/zh-TW.yml
|
141
|
-
- lib/rspec_matcher.rb
|
142
155
|
- lib/validate_url.rb
|
156
|
+
- lib/validate_url/rspec_matcher.rb
|
143
157
|
homepage: http://github.com/perfectline/validates_url/tree/master
|
144
158
|
licenses: []
|
145
159
|
metadata: {}
|
@@ -158,8 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
172
|
- !ruby/object:Gem::Version
|
159
173
|
version: '0'
|
160
174
|
requirements: []
|
161
|
-
|
162
|
-
rubygems_version: 2.4.5.1
|
175
|
+
rubygems_version: 3.0.6
|
163
176
|
signing_key:
|
164
177
|
specification_version: 4
|
165
178
|
summary: Library for validating urls in Rails.
|