validates_url_format_of 0.4.1 → 0.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3da9effc4336d14d3fcb83603fd2ce960053c94
4
- data.tar.gz: 347857fd8cceeb25541252bc6b1912acf4165056
3
+ metadata.gz: f0bb35bbaf41419d8016af89dfcf3dfe5bf2bed6
4
+ data.tar.gz: a96156e9123f6a541bd93126475256fe1aa5876b
5
5
  SHA512:
6
- metadata.gz: ef0d57fa3ea78d62750171924434bcc176990c95dea3d4cbbe8ec8ddbdad2c50f07dd8a06e39ab2d324d47615877b228c0fb814d3013664a9a0b77b6cb5b9869
7
- data.tar.gz: 435547d77d56fdc8899d78795566de08c3366d2d4aadb6586513372e46f261952b4d081efdecea6be3e2edcd48539a1c93975c0379c91a807b323b5d8345fe7b
6
+ metadata.gz: cbf098d2ff2795679141fd375e34e5def2e294f8ff5b50565a1cc8987e47053c70625aabab5a377c5492a97d4d5f5269edfdfe6413274a12700f25c4d9ae9ebb
7
+ data.tar.gz: b2a19ad934bc38d28f51992078ebf6e2cd87d4316d79c56bffa1f20624ea44b6e7dbf25f6b5093c378ad545647415b46cc9bd323df79fc64fc123480293c087e
@@ -1,12 +1,12 @@
1
1
  require 'active_record'
2
2
 
3
3
  module ValidatesUrlFormatOf
4
- IPV4_PART = /\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]/ # 0-255
4
+ IPV4_PART = /\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]/ # 0-255
5
5
  REGEXP = %r{
6
6
  \A
7
7
  https?:// # http:// or https://
8
8
  ([^\s:@]+:[^\s:@]*@)? # optional username:pw@
9
- ( (xn--)?(\-|[a-z0-9])+([-.][a-z0-9]+)*\.[a-z]{2,6}\.? | # domain (including Punycode/IDN)...
9
+ ( (xn--)?(\-|[a-z0-9])+([-.][a-z0-9]+)*\.[a-z]{2,13}\.? | # domain (including Punycode/IDN)...
10
10
  #{IPV4_PART}(\.#{IPV4_PART}){3} ) # or IPv4
11
11
  (:\d{1,5})? # optional port
12
12
  ([/?]\S*)? # optional /whatever or ?whatever
@@ -1,18 +1,15 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.add_dependency 'activerecord', ['>= 3.1', '< 5']
3
3
  spec.add_development_dependency 'bundler', '~> 1.0'
4
- spec.authors = ['Erik Michels-Ober', 'Henrik Nyh', 'Josh Nichols', 'Nicholas Silva']
5
- spec.description = %q{Rails plugin that provides a validates_url_format_of method to ActiveRecord models. URLs are validated by regexp.}
6
- spec.email = %w[conickal@gmail.com]
7
- spec.files = %w[LICENSE.md README.md Gemfile Rakefile validates_url_format_of.gemspec]
8
- spec.files += Dir.glob('lib/**/*.rb')
9
- spec.files += Dir.glob('test/**/*')
10
- spec.homepage = 'http://github.com/conickal/validates_url_format_of'
11
- spec.licenses = %w[MIT]
12
- spec.name = 'validates_url_format_of'
13
- spec.require_paths = %w[lib]
14
- spec.required_rubygems_version = '>= 1.3.5'
15
- spec.summary = %q{ActiveRecord URL Validation}
16
- spec.test_files = Dir.glob('test/**/*')
17
- spec.version = '0.4.1'
4
+ spec.authors = ['Erik Michels-Ober', 'Henrik Nyh', 'Josh Nichols', 'Nicholas Silva']
5
+ spec.description = 'Rails plugin that provides a validates_url_format_of method to ActiveRecord models. URLs are validated by regexp.'
6
+ spec.email = %w(conickal@gmail.com)
7
+ spec.files = %w(LICENSE.md README.md validates_url_format_of.gemspec) + Dir['lib/**/*.rb']
8
+ spec.homepage = 'http://github.com/conickal/validates_url_format_of'
9
+ spec.licenses = %w(MIT)
10
+ spec.name = 'validates_url_format_of'
11
+ spec.require_paths = %w(lib)
12
+ spec.required_ruby_version = '>= 1.9.3'
13
+ spec.summary = 'ActiveRecord URL Validation'
14
+ spec.version = '0.4.2'
18
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validates_url_format_of
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Michels-Ober
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-01-02 00:00:00.000000000 Z
14
+ date: 2017-02-22 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activerecord
@@ -55,14 +55,9 @@ executables: []
55
55
  extensions: []
56
56
  extra_rdoc_files: []
57
57
  files:
58
- - Gemfile
59
58
  - LICENSE.md
60
59
  - README.md
61
- - Rakefile
62
60
  - lib/validates_url_format_of.rb
63
- - test/helper.rb
64
- - test/model.rb
65
- - test/validates_url_format_of_test.rb
66
61
  - validates_url_format_of.gemspec
67
62
  homepage: http://github.com/conickal/validates_url_format_of
68
63
  licenses:
@@ -76,20 +71,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
71
  requirements:
77
72
  - - ">="
78
73
  - !ruby/object:Gem::Version
79
- version: '0'
74
+ version: 1.9.3
80
75
  required_rubygems_version: !ruby/object:Gem::Requirement
81
76
  requirements:
82
77
  - - ">="
83
78
  - !ruby/object:Gem::Version
84
- version: 1.3.5
79
+ version: '0'
85
80
  requirements: []
86
81
  rubyforge_project:
87
- rubygems_version: 2.2.0
82
+ rubygems_version: 2.6.10
88
83
  signing_key:
89
84
  specification_version: 4
90
85
  summary: ActiveRecord URL Validation
91
- test_files:
92
- - test/helper.rb
93
- - test/model.rb
94
- - test/validates_url_format_of_test.rb
95
- has_rdoc:
86
+ test_files: []
data/Gemfile DELETED
@@ -1,29 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'maruku'
4
- gem 'rake'
5
- gem 'yard'
6
-
7
- platforms :jruby do
8
- gem 'activerecord-jdbcsqlite3-adapter'
9
- gem 'jdbc-sqlite3'
10
- gem 'jruby-openssl'
11
- end
12
-
13
- group :test do
14
- gem 'backports'
15
- gem 'minitest'
16
- gem 'rubocop', '>= 0.16', :platforms => [:ruby_19, :ruby_20, :ruby_21]
17
- gem 'simplecov', :require => false
18
- gem 'sqlite3', :platforms => :ruby
19
- gem 'yardstick'
20
- end
21
-
22
- platforms :rbx do
23
- gem 'racc'
24
- gem 'rubinius-coverage', '~> 2.0'
25
- gem 'rubysl', '~> 2.0'
26
- gem 'rubysl-json', '~> 2.0'
27
- end
28
-
29
- gemspec
data/Rakefile DELETED
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env rake
2
-
3
- require 'bundler'
4
- Bundler::GemHelper.install_tasks
5
-
6
- require 'rake/testtask'
7
- Rake::TestTask.new(:test) do |test|
8
- test.libs << 'lib' << 'test'
9
- test.pattern = 'test/**/*_test.rb'
10
- test.verbose = true
11
- end
12
-
13
- begin
14
- require 'rubocop/rake_task'
15
- Rubocop::RakeTask.new
16
- rescue LoadError
17
- task :rubocop do
18
- $stderr.puts 'Rubocop is disabled'
19
- end
20
- end
21
-
22
- require 'yard'
23
- YARD::Rake::YardocTask.new do |task|
24
- task.files = %w[LICENSE.md lib/**/*.rb]
25
- task.options = %w[--markup markdown]
26
- end
27
-
28
- require 'yardstick/rake/measurement'
29
- Yardstick::Rake::Measurement.new do |measurement|
30
- measurement.output = 'measurement/report.txt'
31
- end
32
-
33
- require 'yardstick/rake/verify'
34
- Yardstick::Rake::Verify.new do |verify|
35
- verify.threshold = 50.0
36
- end
37
-
38
- task :default => [:test, :rubocop, :verify_measurements]
@@ -1,23 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('..', __FILE__)
2
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
- require 'simplecov'
4
- SimpleCov.start do
5
- add_filter '/spec/'
6
- minimum_coverage(100)
7
- end
8
- require 'validates_url_format_of'
9
- require 'active_record'
10
- require 'model'
11
- require 'minitest/autorun'
12
-
13
- unless ActiveRecord::Base.connected?
14
- ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
15
- ActiveRecord::Migration.verbose = false
16
- ActiveRecord::Schema.define(:version => 0) do
17
- create_table :models, :force => true do |t|
18
- t.string :homepage
19
- t.string :my_UrL_hooray
20
- t.string :custom_url
21
- end
22
- end
23
- end
@@ -1,5 +0,0 @@
1
- class Model < ActiveRecord::Base
2
- validates_url_format_of :homepage
3
- validates_url_format_of :my_UrL_hooray
4
- validates_url_format_of :custom_url, :message => 'custom message'
5
- end
@@ -1,74 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- class ValidatesUrlFormatOfTest < MiniTest::Unit::TestCase
4
- def setup
5
- @model = Model.new
6
- end
7
-
8
- def test_should_allow_valid_urls # rubocop:disable MethodLength
9
- [
10
- 'http://example.com',
11
- 'http://example.com/',
12
- 'http://www.example.com/',
13
- 'http://sub.domain.example.com/',
14
- 'http://bbc.co.uk',
15
- 'http://example.com?foo',
16
- 'http://example.com?url=http://example.com',
17
- 'http://example.com:8000',
18
- 'http://www.sub.example.com/page.html?foo=bar&baz=%23#anchor',
19
- 'http://user:pass@example.com',
20
- 'http://user:@example.com',
21
- 'http://example.com/~user',
22
- 'http://example.xy', # Not a real TLD, but we're fine with anything of 2-6 chars
23
- 'http://example.museum',
24
- 'http://1.0.255.249',
25
- 'http://1.2.3.4:80',
26
- 'HttP://example.com',
27
- 'https://example.com',
28
- 'http://xn--rksmrgs-5wao1o.nu', # Punycode
29
- 'http://example.com.', # Explicit TLD root period
30
- 'http://example.com./foo',
31
- 'http://innsofaurora--com.rztrkr.com/accommodations/?rzreturn=1&rzsource=nc'
32
- ].each do |url|
33
- @model.homepage = url
34
- @model.save
35
- assert @model.errors[:homepage].empty?, "#{url.inspect} should have been accepted"
36
- end
37
- end
38
-
39
- def test_should_reject_invalid_urls # rubocop:disable MethodLength
40
- [
41
- nil, 1, '', ' ', 'url',
42
- 'www.example.com',
43
- 'http://ex ample.com',
44
- 'http://example.com/foo bar',
45
- 'http://256.0.0.1',
46
- 'http://u:u:u@example.com',
47
- 'http://r?ksmorgas.com',
48
-
49
- # These can all be valid local URLs, but should not be considered valid
50
- # for public consumption.
51
- 'http://example',
52
- 'http://example.c',
53
- 'http://example.toolongtld'
54
- ].each do |url|
55
- @model.homepage = url
56
- @model.save
57
- assert @model.errors[:homepage], "#{url.inspect} should have been rejected"
58
- end
59
- end
60
-
61
- def test_different_defaults_based_on_attribute_name
62
- @model.homepage = 'x'
63
- @model.my_UrL_hooray = 'x'
64
- @model.save
65
- assert_equal ValidatesUrlFormatOf::DEFAULT_MESSAGE, @model.errors[:homepage].first
66
- assert_equal ValidatesUrlFormatOf::DEFAULT_MESSAGE_URL, @model.errors[:my_UrL_hooray].first
67
- end
68
-
69
- def test_can_override_defaults
70
- @model.custom_url = 'x'
71
- @model.save
72
- assert_equal 'custom message', @model.errors[:custom_url].first
73
- end
74
- end