validates_host 1.2.0 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5b11543c72bb9ea5223f7f216d24f79606ca13e2f9d97967718132ef9589158
4
- data.tar.gz: 3338ae72f989b7fa89cc546918519b69cd2000ef0c081a14afe465720ce0ae4f
3
+ metadata.gz: 145ca9cab05675368ca33a513820cdaca5c50747a197635c48455b94464bf93b
4
+ data.tar.gz: 9dafd02e5e4481a18c05c475eaea0c70c438886efe13d9cf9ed3735f8fb1016f
5
5
  SHA512:
6
- metadata.gz: e4146e5334ec9aa078d6f715f225296e73625a10c3508bfa67bbaca3a85092326049873ae7cf8a7d0a5cec4bbbdd5a04c262bc1d7b70e6c100b8101d0263e755
7
- data.tar.gz: 8d122306cf4753d4e077a0b76c92d5f8da7c9623f17cf1ff3c5f40368c42794f3da1ccb02e2cb66d68e923cd767e367fcfbfc63585bf5082780a7f97454b1530
6
+ metadata.gz: a99df100cd2ec1b958a3462bd8f314a75687f4e0d0949b80cc4d7dcb8b19a7cd8484d2c9c94444aca8c40bd3c1efff3a0ba8fbee0a9086a52d9615093c436507
7
+ data.tar.gz: d10314be5e20e31cc370d8245b42ce5c976d9ab4a4f4129e2d5de3627dbcf728d79d9819c54e0c95047b40b5b3107d38d8665a585ee3187045838170ac321404
data/.rubocop.yml CHANGED
@@ -1,5 +1,9 @@
1
1
  require: rubocop-rspec
2
2
 
3
+ AllCops:
4
+ TargetRubyVersion: 2.0
5
+ NewCops: enable
6
+
3
7
  Layout/EmptyLinesAroundAttributeAccessor:
4
8
  Enabled: true
5
9
 
data/.travis.yml CHANGED
@@ -24,8 +24,22 @@ matrix:
24
24
  gemfile: gemfiles/Gemfile.rails4
25
25
  - rvm: 2.5
26
26
  gemfile: gemfiles/Gemfile.rails5
27
+ - rvm: 2.5
28
+ gemfile: gemfiles/Gemfile.rails6
27
29
  - rvm: 2.6
28
30
  gemfile: gemfiles/Gemfile.rails4
29
31
  - rvm: 2.6
30
32
  gemfile: gemfiles/Gemfile.rails5
33
+ - rvm: 2.6
34
+ gemfile: gemfiles/Gemfile.rails6
35
+ - rvm: 2.7
36
+ gemfile: gemfiles/Gemfile.rails4
37
+ - rvm: 2.7
38
+ gemfile: gemfiles/Gemfile.rails5
39
+ - rvm: 2.7
40
+ gemfile: gemfiles/Gemfile.rails6
41
+ - rvm: 3.0
42
+ gemfile: gemfiles/Gemfile.rails4
43
+ - rvm: 3.0
44
+ gemfile: gemfiles/Gemfile.rails6
31
45
  script: rake complete
data/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/validates_host.png)](http://badge.fury.io/rb/validates_host) [![Build Status](https://secure.travis-ci.org/plribeiro3000/validates_host.png?branch=master)](http://travis-ci.org/plribeiro3000/validates_host) [![Coverage Status](https://coveralls.io/repos/plribeiro3000/validates_host/badge.png?branch=master)](https://coveralls.io/r/plribeiro3000/validates_host) [![Code Climate](https://codeclimate.com/github/plribeiro3000/validates_host.png)](https://codeclimate.com/github/plribeiro3000/validates_host)
4
4
 
5
- Validates host attributes and test it in a simple way
5
+ Validates host attributes and test it in a simple way.
6
+ Supports ruby 2.0+ and rails 3+
6
7
 
7
8
  ## Installation
8
9
 
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gem 'activesupport', '3.2.14'
4
4
  gem 'mime-types', '< 2.0'
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gem 'activesupport', '>= 4.0.0', '< 5.0.0'
4
4
 
@@ -1,5 +1,5 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
- gem 'activesupport', '>= 5.0.0'
3
+ gem 'activesupport', '>= 5.0.0', '< 6.0.0'
4
4
 
5
- gemspec :path => '../'
5
+ gemspec :path => '../'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activesupport', '>= 6.0.0'
4
+
5
+ gemspec :path => '../'
@@ -2,6 +2,15 @@
2
2
 
3
3
  class DomainNameValidator < ActiveModel::EachValidator
4
4
  def validate_each(record, attribute, value)
5
- record.errors.add(attribute, :invalid, options) unless ValidatesHost::DomainName.new(value).valid?
5
+ return if ValidatesHost::DomainName.new(value).valid?
6
+
7
+ ruby_prior_version_three =
8
+ Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.0.0')
9
+
10
+ if ruby_prior_version_three
11
+ record.errors.add(attribute, :invalid, options)
12
+ else
13
+ record.errors.add(attribute, :invalid, **options)
14
+ end
6
15
  end
7
16
  end
@@ -2,6 +2,15 @@
2
2
 
3
3
  class HostNameValidator < ActiveModel::EachValidator
4
4
  def validate_each(record, attribute, value)
5
- record.errors.add(attribute, :invalid, options) unless ValidatesHost::HostName.new(value).valid?
5
+ return if ValidatesHost::HostName.new(value).valid?
6
+
7
+ ruby_prior_version_three =
8
+ Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.0.0')
9
+
10
+ if ruby_prior_version_three
11
+ record.errors.add(attribute, :invalid, options)
12
+ else
13
+ record.errors.add(attribute, :invalid, **options)
14
+ end
6
15
  end
7
16
  end
@@ -2,6 +2,15 @@
2
2
 
3
3
  class IpValidator < ActiveModel::EachValidator
4
4
  def validate_each(record, attribute, value)
5
- record.errors.add(attribute, :invalid, options) unless ValidatesHost::Ip.new(value).valid?
5
+ return if ValidatesHost::Ip.new(value).valid?
6
+
7
+ ruby_prior_version_three =
8
+ Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.0.0')
9
+
10
+ if ruby_prior_version_three
11
+ record.errors.add(attribute, :invalid, options)
12
+ else
13
+ record.errors.add(attribute, :invalid, **options)
14
+ end
6
15
  end
7
16
  end
@@ -2,6 +2,15 @@
2
2
 
3
3
  class SubnetValidator < ActiveModel::EachValidator
4
4
  def validate_each(record, attribute, value)
5
- record.errors.add(attribute, :invalid, options) unless ValidatesHost::Subnet.new(value).valid?
5
+ return if ValidatesHost::Subnet.new(value).valid?
6
+
7
+ ruby_prior_version_three =
8
+ Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.0.0')
9
+
10
+ if ruby_prior_version_three
11
+ record.errors.add(attribute, :invalid, options)
12
+ else
13
+ record.errors.add(attribute, :invalid, **options)
14
+ end
6
15
  end
7
16
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ValidatesHost
4
- VERSION = '1.2.0'
4
+ VERSION = '1.3.0'.freeze
5
5
  end
@@ -9,17 +9,18 @@ Gem::Specification.new do |gem|
9
9
  gem.email = 'plribeiro3000@gmail.com'
10
10
  gem.summary = 'Validates Host, Domain and IP and test it with matchers in a simple way.'
11
11
 
12
- gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
13
- gem.test_files = `git ls-files -- {test,spec,features,examples,gemfiles}/*`.split("\n")
14
- gem.executables = `git ls-files -- bin/*`.split('\n').map { |f| File.basename(f) }
15
- gem.require_paths = %w[lib]
12
+ gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
13
+ gem.test_files = `git ls-files -- {test,spec,features,examples,gemfiles}/*`.split("\n")
14
+ gem.executables = `git ls-files -- bin/*`.split('\n').map { |f| File.basename(f) }
15
+ gem.require_paths = %w[lib]
16
+ gem.required_ruby_version = '>= 2.0.0'
16
17
 
17
18
  gem.license = 'MIT'
18
19
 
19
20
  gem.add_development_dependency 'coveralls'
20
21
  gem.add_development_dependency 'rake'
21
22
  gem.add_development_dependency 'rspec'
22
- gem.add_development_dependency 'rubocop'
23
+ gem.add_development_dependency 'rubocop', '< 0.50'
23
24
  gem.add_development_dependency 'rubocop-rspec'
24
25
  gem.add_development_dependency 'shoulda-matchers'
25
26
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validates_host
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Henrique Lopes Ribeiro
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-07 00:00:00.000000000 Z
11
+ date: 2021-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coveralls
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "<"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '0.50'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "<"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '0.50'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop-rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 3.0.0
111
- description:
111
+ description:
112
112
  email: plribeiro3000@gmail.com
113
113
  executables: []
114
114
  extensions: []
@@ -126,6 +126,7 @@ files:
126
126
  - gemfiles/Gemfile.rails3
127
127
  - gemfiles/Gemfile.rails4
128
128
  - gemfiles/Gemfile.rails5
129
+ - gemfiles/Gemfile.rails6
129
130
  - lib/validates_host.rb
130
131
  - lib/validates_host/domain_name.rb
131
132
  - lib/validates_host/domain_name_validator.rb
@@ -152,11 +153,11 @@ files:
152
153
  - spec/validates_host/ip_validator_spec.rb
153
154
  - spec/validates_host/subnet_validator_spec.rb
154
155
  - validates_host.gemspec
155
- homepage:
156
+ homepage:
156
157
  licenses:
157
158
  - MIT
158
159
  metadata: {}
159
- post_install_message:
160
+ post_install_message:
160
161
  rdoc_options: []
161
162
  require_paths:
162
163
  - lib
@@ -164,21 +165,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
165
  requirements:
165
166
  - - ">="
166
167
  - !ruby/object:Gem::Version
167
- version: '0'
168
+ version: 2.0.0
168
169
  required_rubygems_version: !ruby/object:Gem::Requirement
169
170
  requirements:
170
171
  - - ">="
171
172
  - !ruby/object:Gem::Version
172
173
  version: '0'
173
174
  requirements: []
174
- rubygems_version: 3.1.3
175
- signing_key:
175
+ rubygems_version: 3.1.4
176
+ signing_key:
176
177
  specification_version: 4
177
178
  summary: Validates Host, Domain and IP and test it with matchers in a simple way.
178
179
  test_files:
179
180
  - gemfiles/Gemfile.rails3
180
181
  - gemfiles/Gemfile.rails4
181
182
  - gemfiles/Gemfile.rails5
183
+ - gemfiles/Gemfile.rails6
182
184
  - spec/fake_app/server.rb
183
185
  - spec/fake_app/subnet.rb
184
186
  - spec/shoulda/matchers/active_model/require_a_valid_domain_name_matcher_spec.rb