url_regex 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.rubocop.yml +4 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +88 -0
- data/Rakefile +6 -0
- data/lib/url_regex/version.rb +3 -0
- data/lib/url_regex.rb +60 -0
- data/spec/url_regex_spec.rb +226 -0
- data/url_regex.gemspec +27 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b54cf0655c5a8a50fa9fd49b1a2de6886a040f8b
|
4
|
+
data.tar.gz: ef1c34438f36acf88975b0ead1ce81bfd30b7982
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c32d4b0eda559e9753d38432e63328989a38b7f6991ec978f3a854d21544f06df4a1a68e6f7cf91a11ac8e6b4f255b2405e010dd1b31dec21da74c71e32a07d6
|
7
|
+
data.tar.gz: 07718688349b9cebbc4a353db0d60e328d52acdfd9683eb0713e80697bb6ef044dd6a1e04ef471f31383a687ce6ef7bd6e7be59fb4e85cffee848a0add650e10
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
.idea/
|
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Alexey Mogilnikov
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/amogil/url_regex.svg?branch=master)](https://travis-ci.org/amogil/url_regex)
|
2
|
+
[![Code Climate](https://codeclimate.com/github/amogil/url_regex/badges/gpa.svg)](https://codeclimate.com/github/amogil/url_regex)
|
3
|
+
[![GitHub version](https://badge.fury.io/gh/amogil%2Furl_regex.svg)](https://badge.fury.io/gh/amogil%2Furl_regex)
|
4
|
+
[![Dependency Status](https://gemnasium.com/badges/github.com/amogil/url_regex.svg)](https://gemnasium.com/github.com/amogil/url_regex)
|
5
|
+
|
6
|
+
# UrlRegex
|
7
|
+
|
8
|
+
Provides the best known regex for validating and extracting URLs.
|
9
|
+
It uses amazing job done by [Diego Perini](https://gist.github.com/dperini/729294)
|
10
|
+
and [Mathias Bynens](https://mathiasbynens.be/demo/url-regex).
|
11
|
+
|
12
|
+
Why do we need a gem for this regex?
|
13
|
+
|
14
|
+
- You don't need to watch changes and improvements of original regex.
|
15
|
+
- You have an ability to slightly customize the regex: a scheme can be optional, can get the regex for validation or parsing.
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
Add this line to your application's Gemfile:
|
20
|
+
|
21
|
+
gem 'url_regex'
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
$ gem install url_regex
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
Get the regex:
|
34
|
+
|
35
|
+
UrlRegex.get(options)
|
36
|
+
|
37
|
+
where options are:
|
38
|
+
|
39
|
+
- `scheme_required` indicates that schema is required, defaults to `true`.
|
40
|
+
|
41
|
+
- `mode` can gets either `:validation` or `:parsing`, defaults to `:validation`.
|
42
|
+
|
43
|
+
`:validation` asks to return the regex for validation, namely, with `\A` prefix, and with `\z` postfix.
|
44
|
+
That means, it matches whole text:
|
45
|
+
|
46
|
+
UrlRegex.get(mode: :validation).match('https://www.google.com').nil?
|
47
|
+
# => false
|
48
|
+
UrlRegex.get(mode: :validation).match('link: https://www.google.com').nil?
|
49
|
+
# => true
|
50
|
+
|
51
|
+
`:parsing` asks to return the regex for parsing:
|
52
|
+
|
53
|
+
str = 'links: google.com https://google.com?t=1'
|
54
|
+
str.scan(UrlRegex.get(mode: :parsing))
|
55
|
+
# => ["https://google.com?t=1"]
|
56
|
+
|
57
|
+
# schema is not required
|
58
|
+
str.scan(UrlRegex.get(scheme_required: false, mode: :parsing))
|
59
|
+
# => ["google.com", "https://google.com?t=1"]
|
60
|
+
|
61
|
+
`UrlRegex.get` returns regular Ruby's [Regex](http://ruby-doc.org/core-2.0.0/Regexp.html) object,
|
62
|
+
so you can use it as usual.
|
63
|
+
|
64
|
+
All regexes are case-insensitive.
|
65
|
+
|
66
|
+
## FAQ
|
67
|
+
|
68
|
+
Q: Hey, I want to parse HTML, but it doesn't work:
|
69
|
+
|
70
|
+
str = '<a href="http://google.com?t=1">Link</a>'
|
71
|
+
str.scan(UrlRegex.get(mode: :parsing))
|
72
|
+
# => "http://google.com?t=1">Link</a>"
|
73
|
+
|
74
|
+
A: Well, you probably know that parsing HTML with regex is
|
75
|
+
[a bad idea](https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags).
|
76
|
+
It requires matching corresponding open and close brackets, that makes the regex even more complicated.
|
77
|
+
|
78
|
+
Q: How can I speed up processing?
|
79
|
+
|
80
|
+
A: Generated regex depends only on options, so you can get the regex only once and cache it.
|
81
|
+
|
82
|
+
## Contributing
|
83
|
+
|
84
|
+
1. Fork it ( https://github.com/[my-github-username]/url_regex/fork )
|
85
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
86
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
87
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
88
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/url_regex.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'url_regex/version'
|
2
|
+
|
3
|
+
# Provides the best known regex for validating and extracting URLs.
|
4
|
+
# It uses amazing job done by [Diego Perini](https://gist.github.com/dperini/729294)
|
5
|
+
# and [Mathias Bynens](https://mathiasbynens.be/demo/url-regex).
|
6
|
+
|
7
|
+
module UrlRegex
|
8
|
+
# Returns the regex for URLs parsing or validating.
|
9
|
+
#
|
10
|
+
# @param scheme_required [Boolean] will the regex require scheme presence, defaults to true
|
11
|
+
# @param mode [Symbol] purpose of the regex, `:validation` or `parsing`, defaults to `:validation`
|
12
|
+
# @return [Regex] regex for parsing or validating
|
13
|
+
def self.get(scheme_required: true, mode: :validation)
|
14
|
+
raise ArgumentError, "wrong mode: #{mode}" if MODES.index(mode).nil?
|
15
|
+
scheme = scheme_required ? PROTOCOL_IDENTIFIER : PROTOCOL_IDENTIFIER_OPTIONAL
|
16
|
+
mode == :validation ? /\A#{scheme} #{BASE}\z/xi : /#{scheme} #{BASE}/xi
|
17
|
+
end
|
18
|
+
|
19
|
+
BASE = '
|
20
|
+
# user:pass authentication
|
21
|
+
(?:\S+(?::\S*)?@)?
|
22
|
+
|
23
|
+
(?:
|
24
|
+
# IP address exclusion
|
25
|
+
# private & local networks
|
26
|
+
(?!(?:10|127)(?:\.\d{1,3}){3})
|
27
|
+
(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})
|
28
|
+
(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})
|
29
|
+
# IP address dotted notation octets
|
30
|
+
# excludes loopback network 0.0.0.0
|
31
|
+
# excludes reserved space >= 224.0.0.0
|
32
|
+
# excludes network & broadcast addresses
|
33
|
+
# (first & last IP address of each class)
|
34
|
+
(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])
|
35
|
+
(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}
|
36
|
+
(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))
|
37
|
+
|
|
38
|
+
# host name
|
39
|
+
(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)
|
40
|
+
# domain name
|
41
|
+
(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*
|
42
|
+
# TLD identifier
|
43
|
+
(?:\.(?:[a-z\u00a1-\uffff]{2,}))
|
44
|
+
# TLD may end with dot
|
45
|
+
\.?
|
46
|
+
)
|
47
|
+
|
48
|
+
# port number
|
49
|
+
(?::\d{2,5})?
|
50
|
+
|
51
|
+
# resource path
|
52
|
+
(?:[/?#]\S*)?
|
53
|
+
'.freeze
|
54
|
+
|
55
|
+
PROTOCOL_IDENTIFIER = '(?:(?:https?|ftp)://)'.freeze
|
56
|
+
PROTOCOL_IDENTIFIER_OPTIONAL = '(?:(?:https?|ftp)://)?'.freeze
|
57
|
+
MODES = [:validation, :parsing].freeze
|
58
|
+
|
59
|
+
private_constant :BASE, :PROTOCOL_IDENTIFIER, :PROTOCOL_IDENTIFIER_OPTIONAL, :MODES
|
60
|
+
end
|
@@ -0,0 +1,226 @@
|
|
1
|
+
require 'url_regex'
|
2
|
+
|
3
|
+
describe UrlRegex do
|
4
|
+
describe '.get' do
|
5
|
+
it 'should allow :parsing as mode values' do
|
6
|
+
expect(UrlRegex.get(mode: :parsing)).to be
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should raise ArgumentError if mode neither :validation nor :parsing' do
|
10
|
+
expect { UrlRegex.get(mode: nil) }.to raise_error ArgumentError
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'Full validation regex' do
|
15
|
+
[
|
16
|
+
'http://foo.com/blah_blah',
|
17
|
+
'http://foo.com/blah_blah/',
|
18
|
+
'http://foo.com/blah_blah_(wikipedia)',
|
19
|
+
'http://foo.com/blah_blah_(wikipedia)_(again)',
|
20
|
+
'http://www.example.com/wpstyle/?p=364',
|
21
|
+
'https://www.example.com/foo/?bar=baz&inga=42&quux',
|
22
|
+
'http://✪df.ws/123',
|
23
|
+
'http://userid:password@example.com:8080',
|
24
|
+
'http://userid:password@example.com:8080/',
|
25
|
+
'http://userid@example.com',
|
26
|
+
'http://userid@example.com/',
|
27
|
+
'http://userid@example.com:8080',
|
28
|
+
'http://userid@example.com:8080/',
|
29
|
+
'http://userid:password@example.com',
|
30
|
+
'http://userid:password@example.com/',
|
31
|
+
'http://142.42.1.1/',
|
32
|
+
'http://142.42.1.1:8080/',
|
33
|
+
'http://➡.ws/䨹',
|
34
|
+
'http://⌘.ws',
|
35
|
+
'http://⌘.ws/',
|
36
|
+
'http://foo.com/blah_(wikipedia)#cite-1',
|
37
|
+
'http://foo.com/blah_(wikipedia)_blah#cite-1',
|
38
|
+
'http://foo.com/unicode_(✪)_in_parens',
|
39
|
+
'http://foo.com/(something)?after=parens',
|
40
|
+
'http://☺.damowmow.com/',
|
41
|
+
'http://code.google.com/events/#&product=browser',
|
42
|
+
'http://j.mp',
|
43
|
+
'ftp://foo.bar/baz',
|
44
|
+
'http://foo.bar/?q=Test%20URL-encoded%20stuff',
|
45
|
+
'http://مثال.إختبار',
|
46
|
+
'http://例子.测试',
|
47
|
+
'http://उदाहरण.परीक्षा',
|
48
|
+
"http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com",
|
49
|
+
'http://1337.net',
|
50
|
+
'http://a.b-c.de',
|
51
|
+
'http://a.b--c.de/',
|
52
|
+
'http://www.foo.bar./',
|
53
|
+
'http://223.255.255.254',
|
54
|
+
'http://example.org?foo=bar'
|
55
|
+
].each do |valid_url|
|
56
|
+
it "should match #{valid_url}" do
|
57
|
+
expect(UrlRegex.get(scheme_required: true)).to match valid_url
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
[
|
62
|
+
'http://',
|
63
|
+
'http://.',
|
64
|
+
'http://..',
|
65
|
+
'http://../',
|
66
|
+
'http://?',
|
67
|
+
'http://??',
|
68
|
+
'http://??/',
|
69
|
+
'http://#',
|
70
|
+
'http://##',
|
71
|
+
'http://##/',
|
72
|
+
'http://foo.bar?q=Spaces should be encoded',
|
73
|
+
'//',
|
74
|
+
'//a',
|
75
|
+
'///a',
|
76
|
+
'///',
|
77
|
+
'http:///a',
|
78
|
+
'foo.com',
|
79
|
+
'rdar://1234',
|
80
|
+
'h://test',
|
81
|
+
'http:// shouldfail.com',
|
82
|
+
':// should fail',
|
83
|
+
'http://foo.bar/foo(bar)baz quux',
|
84
|
+
'ftps://foo.bar/',
|
85
|
+
'http://-error-.invalid/',
|
86
|
+
'http://-a.b.co',
|
87
|
+
'http://a.b-.co',
|
88
|
+
'http://0.0.0.0',
|
89
|
+
'http://10.1.1.0',
|
90
|
+
'http://10.1.1.255',
|
91
|
+
'http://224.1.1.1',
|
92
|
+
'http://1.1.1.1.1',
|
93
|
+
'http://123.123.123',
|
94
|
+
'http://3628126748',
|
95
|
+
'http://.www.foo.bar/',
|
96
|
+
'http://.www.foo.bar./',
|
97
|
+
'http://10.1.1.1',
|
98
|
+
'http://10.1.1.254'
|
99
|
+
].each do |invalid_url|
|
100
|
+
it "should not match #{invalid_url}" do
|
101
|
+
expect(UrlRegex.get(scheme_required: true)).to_not match invalid_url
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe 'Optional scheme validation regex' do
|
107
|
+
[
|
108
|
+
'foo.com/blah_blah',
|
109
|
+
'foo.com/blah_blah/',
|
110
|
+
'foo.com/blah_blah_(wikipedia)',
|
111
|
+
'foo.com/blah_blah_(wikipedia)_(again)',
|
112
|
+
'www.example.com/wpstyle/?p=364',
|
113
|
+
'www.example.com/foo/?bar=baz&inga=42&quux',
|
114
|
+
'✪df.ws/123',
|
115
|
+
'userid:password@example.com:8080',
|
116
|
+
'userid:password@example.com:8080/',
|
117
|
+
'userid@example.com',
|
118
|
+
'userid@example.com/',
|
119
|
+
'userid@example.com:8080',
|
120
|
+
'userid@example.com:8080/',
|
121
|
+
'userid:password@example.com',
|
122
|
+
'userid:password@example.com/',
|
123
|
+
'142.42.1.1/',
|
124
|
+
'142.42.1.1:8080/',
|
125
|
+
'➡.ws/䨹',
|
126
|
+
'⌘.ws',
|
127
|
+
'⌘.ws/',
|
128
|
+
'foo.com/blah_(wikipedia)#cite-1',
|
129
|
+
'foo.com/blah_(wikipedia)_blah#cite-1',
|
130
|
+
'foo.com/unicode_(✪)_in_parens',
|
131
|
+
'foo.com/(something)?after=parens',
|
132
|
+
'☺.damowmow.com/',
|
133
|
+
'code.google.com/events/#&product=browser',
|
134
|
+
'j.mp',
|
135
|
+
'foo.bar/baz',
|
136
|
+
'foo.bar/?q=Test%20URL-encoded%20stuff',
|
137
|
+
'مثال.إختبار',
|
138
|
+
'例子.测试',
|
139
|
+
'उदाहरण.परीक्षा',
|
140
|
+
"-.~_!$&'()*+,;=:%40:80%2f::::::@example.com",
|
141
|
+
'1337.net',
|
142
|
+
'a.b-c.de',
|
143
|
+
'a.b--c.de/',
|
144
|
+
'www.foo.bar./',
|
145
|
+
'223.255.255.254',
|
146
|
+
'example.org?foo=bar',
|
147
|
+
'google.com?t=2">Link</a>'
|
148
|
+
].each do |valid_url|
|
149
|
+
it "should match #{valid_url}" do
|
150
|
+
expect(UrlRegex.get(scheme_required: false)).to match valid_url
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
[
|
155
|
+
'',
|
156
|
+
'.',
|
157
|
+
'..',
|
158
|
+
'../',
|
159
|
+
'?',
|
160
|
+
'??',
|
161
|
+
'??/',
|
162
|
+
'#',
|
163
|
+
'##',
|
164
|
+
'##/',
|
165
|
+
'foo.bar?q=Spaces should be encoded',
|
166
|
+
'//',
|
167
|
+
'//a',
|
168
|
+
'///a',
|
169
|
+
'///',
|
170
|
+
'/a',
|
171
|
+
'rdar://1234',
|
172
|
+
'h://test',
|
173
|
+
' shouldfail.com',
|
174
|
+
':// should fail',
|
175
|
+
'foo.bar/foo(bar)baz quux',
|
176
|
+
'-error-.invalid/',
|
177
|
+
'-a.b.co',
|
178
|
+
'a.b-.co',
|
179
|
+
'0.0.0.0',
|
180
|
+
'10.1.1.0',
|
181
|
+
'10.1.1.255',
|
182
|
+
'224.1.1.1',
|
183
|
+
'1.1.1.1.1',
|
184
|
+
'123.123.123',
|
185
|
+
'3628126748',
|
186
|
+
'.www.foo.bar/',
|
187
|
+
'.www.foo.bar./',
|
188
|
+
'10.1.1.1',
|
189
|
+
'10.1.1.254'
|
190
|
+
].each do |invalid_url|
|
191
|
+
it "should not match #{invalid_url}" do
|
192
|
+
expect(UrlRegex.get(scheme_required: false)).to_not match invalid_url
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
describe 'Required scheme parsing regex' do
|
198
|
+
let(:regex) { UrlRegex.get(scheme_required: true, mode: :parsing) }
|
199
|
+
|
200
|
+
{
|
201
|
+
'See here: http://google.com?a=1&b=2' => ['http://google.com?a=1&b=2'],
|
202
|
+
'google.com - search engine' => [],
|
203
|
+
'<a href="google.com?t=2">Link</a>' => [],
|
204
|
+
'This text has many links:www.go.com?mode#anchor and https://t.co' => ['https://t.co']
|
205
|
+
}.each do |text, valid_url|
|
206
|
+
it "should parse '#{valid_url}' from '#{text}'" do
|
207
|
+
expect(text.scan(regex)).to eq valid_url
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe 'Optional scheme parsing regex' do
|
213
|
+
let(:regex) { UrlRegex.get(scheme_required: false, mode: :parsing) }
|
214
|
+
|
215
|
+
{
|
216
|
+
'See here: http://google.com?a=1&b=2' => ['http://google.com?a=1&b=2'],
|
217
|
+
'google.com - search engine' => ['google.com'],
|
218
|
+
'<a href="google.com?t=2">Link</a>' => ['google.com?t=2">Link</a>'],
|
219
|
+
'This text has many links:www.go.com?mode#anchor and https://t.co' => ['www.go.com?mode#anchor', 'https://t.co']
|
220
|
+
}.each do |text, valid_url|
|
221
|
+
it "should parse '#{valid_url}' from '#{text}'" do
|
222
|
+
expect(text.scan(regex)).to eq valid_url
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
data/url_regex.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'url_regex/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'url_regex'
|
8
|
+
spec.version = UrlRegex::VERSION
|
9
|
+
spec.authors = ['Alexey Mogilnikov']
|
10
|
+
spec.email = ['alexey@mogilnikov.name']
|
11
|
+
spec.summary = 'Provides the best regex for validating or extracting URLs.'
|
12
|
+
spec.description = 'Provides the best regex for validating or extracting URLs.'
|
13
|
+
spec.homepage = 'https://github.com/amogil/url_regex'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.required_ruby_version = '>= 2.0'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
24
|
+
spec.add_development_dependency 'rake', '~> 0'
|
25
|
+
spec.add_development_dependency 'rubocop', '~> 0'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: url_regex
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexey Mogilnikov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description: Provides the best regex for validating or extracting URLs.
|
70
|
+
email:
|
71
|
+
- alexey@mogilnikov.name
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rubocop.yml"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- lib/url_regex.rb
|
84
|
+
- lib/url_regex/version.rb
|
85
|
+
- spec/url_regex_spec.rb
|
86
|
+
- url_regex.gemspec
|
87
|
+
homepage: https://github.com/amogil/url_regex
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '2.0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.2.2
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: Provides the best regex for validating or extracting URLs.
|
111
|
+
test_files:
|
112
|
+
- spec/url_regex_spec.rb
|