validators 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9f181df550b243432c4e517dd043cddbbdc01615
4
+ data.tar.gz: c8c9555509201f15b3699c23d371c13ab8083fe2
5
+ SHA512:
6
+ metadata.gz: 51a00aa0c7ba19e185a8e8cee3a3f41935acd175d586a923b87d82d4cb49b5243c1e18ccf3eb48c172d02d0ef6f20f085f86cc4150251836c3017da99d8943ca
7
+ data.tar.gz: 667464a246123492c30054884096f1e865b6bb0826026a4ef20e44f922c741ee1362de6e0896e6a0a8613591b3f6bbdbfb3708349533685e77f9d1279a7492d2
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source :rubygems
1
+ source "http://rubygems.org"
2
2
  gemspec
data/Gemfile.lock CHANGED
@@ -1,47 +1,74 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- validators (1.0.0)
4
+ validators (2.0.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
- activemodel (3.1.3)
10
- activesupport (= 3.1.3)
11
- builder (~> 3.0.0)
12
- i18n (~> 0.6)
13
- activerecord (3.1.3)
14
- activemodel (= 3.1.3)
15
- activesupport (= 3.1.3)
16
- arel (~> 2.2.1)
17
- tzinfo (~> 0.3.29)
18
- activesupport (3.1.3)
19
- multi_json (~> 1.0)
20
- arel (2.2.1)
21
- builder (3.0.0)
22
- diff-lcs (1.1.3)
23
- i18n (0.6.0)
24
- multi_json (1.0.4)
25
- rake (0.9.2.2)
26
- rspec (2.7.0)
27
- rspec-core (~> 2.7.0)
28
- rspec-expectations (~> 2.7.0)
29
- rspec-mocks (~> 2.7.0)
30
- rspec-core (2.7.1)
31
- rspec-expectations (2.7.0)
32
- diff-lcs (~> 1.1.2)
33
- rspec-mocks (2.7.0)
34
- sqlite3 (1.3.5)
9
+ activemodel (4.0.1)
10
+ activesupport (= 4.0.1)
11
+ builder (~> 3.1.0)
12
+ activerecord (4.0.1)
13
+ activemodel (= 4.0.1)
14
+ activerecord-deprecated_finders (~> 1.0.2)
15
+ activesupport (= 4.0.1)
16
+ arel (~> 4.0.0)
17
+ activerecord-deprecated_finders (1.0.3)
18
+ activesupport (4.0.1)
19
+ i18n (~> 0.6, >= 0.6.4)
20
+ minitest (~> 4.2)
21
+ multi_json (~> 1.3)
22
+ thread_safe (~> 0.1)
23
+ tzinfo (~> 0.3.37)
24
+ arel (4.0.1)
25
+ atomic (1.1.14)
26
+ awesome_print (1.2.0)
27
+ builder (3.1.4)
28
+ coderay (1.0.9)
29
+ diff-lcs (1.2.5)
30
+ i18n (0.6.5)
31
+ method_source (0.8.2)
32
+ minitest (4.7.5)
33
+ multi_json (1.8.2)
34
+ pry (0.9.12.2)
35
+ coderay (~> 1.0.5)
36
+ method_source (~> 0.8)
37
+ slop (~> 3.4)
38
+ pry-meta (0.0.5)
39
+ awesome_print
40
+ pry
41
+ pry-nav
42
+ pry-remote
43
+ pry-nav (0.2.3)
44
+ pry (~> 0.9.10)
45
+ pry-remote (0.1.7)
46
+ pry (~> 0.9)
47
+ slop (~> 3.0)
48
+ rake (10.1.0)
49
+ rspec (2.14.1)
50
+ rspec-core (~> 2.14.0)
51
+ rspec-expectations (~> 2.14.0)
52
+ rspec-mocks (~> 2.14.0)
53
+ rspec-core (2.14.7)
54
+ rspec-expectations (2.14.4)
55
+ diff-lcs (>= 1.1.3, < 2.0)
56
+ rspec-mocks (2.14.4)
57
+ slop (3.4.6)
58
+ sqlite3 (1.3.8)
35
59
  sqlite3-ruby (1.3.3)
36
60
  sqlite3 (>= 1.3.3)
37
- tzinfo (0.3.31)
61
+ thread_safe (0.1.3)
62
+ atomic
63
+ tzinfo (0.3.38)
38
64
 
39
65
  PLATFORMS
40
66
  ruby
41
67
 
42
68
  DEPENDENCIES
43
- activerecord (~> 3.0)
69
+ activerecord (>= 3.0)
70
+ pry-meta
44
71
  rake
45
- rspec (~> 2.7)
72
+ rspec
46
73
  sqlite3-ruby
47
74
  validators!
@@ -1,30 +1,17 @@
1
1
  module Validators
2
- EMAIL_FORMAT = /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
2
+ EMAIL_FORMAT = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
3
3
 
4
4
  # Source: https://github.com/henrik/validates_url_format_of
5
5
  IPv4_PART = /\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]/ # 0-255
6
6
 
7
- if RUBY_VERSION >= "1.9"
8
- URL_FORMAT = %r[
9
- \A
10
- https?:// # http:// or https://
11
- ([^\s:@]+:[^\s:@]*@)? # optional username:pw@
12
- ( (([^\W_]+\.)*xn--)?[^\W_]+([-.][^\W_]+)*\.[a-z]{2,6}\.? | # domain (including Punycode/IDN)...
13
- #{IPv4_PART}(\.#{IPv4_PART}){3} ) # or IPv4
14
- (:\d{1,5})? # optional port
15
- ([/?]\S*)? # optional /whatever or ?whatever
16
- \Z
17
- ]ixs
18
- else
19
- URL_FORMAT = %r[
20
- \A
21
- https?:// # http:// or https://
22
- ([^\s:@]+:[^\s:@]*@)? # optional username:pw@
23
- ( (([^\W_]+\.)*xn--)?[^\W_]+([-.][^\W_]+)*\.[a-z]{2,6}\.? | # domain (including Punycode/IDN)...
24
- #{IPv4_PART}(\.#{IPv4_PART}){3} ) # or IPv4
25
- (:\d{1,5})? # optional port
26
- ([/?]\S*)? # optional /whatever or ?whatever
27
- \Z
28
- ]ixu
29
- end
7
+ URL_FORMAT = %r[
8
+ \A
9
+ https?:// # http:// or https://
10
+ ([^\s:@]+:[^\s:@]*@)? # optional username:pw@
11
+ ( (([^\W_]+\.)*xn--)?[^\W_]+([-.][^\W_]+)*\.[a-z]{2,6}\.? | # domain (including Punycode/IDN)...
12
+ #{IPv4_PART}(\.#{IPv4_PART}){3} ) # or IPv4
13
+ (:\d{1,5})? # optional port
14
+ ([/?]\S*)? # optional /whatever or ?whatever
15
+ \z
16
+ ]ixs
30
17
  end
@@ -1,6 +1,6 @@
1
1
  module Validators
2
2
  module Version
3
- MAJOR = 1
3
+ MAJOR = 2
4
4
  MINOR = 0
5
5
  PATCH = 0
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
data/lib/validators.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "validators/constants"
2
+ require "validators/ip"
2
3
  require "validators/validates_datetime"
3
4
  require "validators/validates_ip_address"
4
5
  require "validators/validates_email_format_of"
@@ -6,5 +7,4 @@ require "validators/validates_url_format_of"
6
7
  require "validators/validates_ownership_of"
7
8
 
8
9
  module Validators
9
- autoload :Ip, "validators/ip"
10
10
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require "bundler/setup"
2
+ Bundler.setup
3
+
1
4
  require "active_record"
2
5
  require "validators"
3
6
  require "active_support/all"
@@ -17,8 +20,13 @@ RSpec.configure do |config|
17
20
  Time.zone = "America/Sao_Paulo"
18
21
 
19
22
  ActiveRecord::Base.descendants.each do |model|
23
+ next if model.name == "ActiveRecord::SchemaMigration"
24
+
20
25
  model.delete_all
21
- Object.class_eval { remove_const model.name if const_defined?(model.name) }
26
+
27
+ Object.class_eval {
28
+ remove_const model.name if const_defined?(model.name)
29
+ }
22
30
  end
23
31
 
24
32
  load File.dirname(__FILE__) + "/support/models.rb"
@@ -14,9 +14,9 @@ class Task < ActiveRecord::Base
14
14
  end
15
15
 
16
16
  class Buyer < ActiveRecord::Base
17
- set_table_name :users
17
+ self.table_name = :users
18
18
  end
19
19
 
20
20
  class Person < ActiveRecord::Base
21
- set_table_name :users
21
+ self.table_name = :users
22
22
  end
data/validators.gemspec CHANGED
@@ -1,24 +1,24 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "validators/version"
1
+ require "./lib/validators/version"
4
2
 
5
3
  Gem::Specification.new do |s|
4
+ s.required_ruby_version = ">= 1.9"
6
5
  s.name = "validators"
7
6
  s.version = Validators::Version::STRING
8
7
  s.platform = Gem::Platform::RUBY
9
8
  s.authors = ["Nando Vieira"]
10
9
  s.email = ["fnando.vieira@gmail.com"]
11
10
  s.homepage = "http://rubygems.org/gems/validators"
12
- s.summary = "Add some nice Rails 3 ActiveRecord validators."
13
- s.description = "Add some nice Rails 3 ActiveRecord validators."
11
+ s.summary = "Add some nice ActiveRecord validators."
12
+ s.description = s.summary
14
13
 
15
14
  s.files = `git ls-files`.split("\n")
16
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
16
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
17
  s.require_paths = ["lib"]
19
18
 
20
- s.add_development_dependency "activerecord", "~> 3.0"
21
- s.add_development_dependency "rspec", "~> 2.7"
19
+ s.add_development_dependency "activerecord", ">= 3.0"
20
+ s.add_development_dependency "rspec"
22
21
  s.add_development_dependency "sqlite3-ruby"
23
22
  s.add_development_dependency "rake"
23
+ s.add_development_dependency "pry-meta"
24
24
  end
metadata CHANGED
@@ -1,61 +1,86 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validators
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 2.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nando Vieira
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-12-14 00:00:00.000000000 Z
11
+ date: 2013-11-09 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activerecord
16
- requirement: &70198104735240 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ~>
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.0'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *70198104735240
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: rspec
27
- requirement: &70198104734720 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ~>
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
- version: '2.7'
33
+ version: '0'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *70198104734720
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: sqlite3-ruby
38
- requirement: &70198104734340 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - '>='
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :development
45
49
  prerelease: false
46
- version_requirements: *70198104734340
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: rake
49
- requirement: &70198104733860 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-meta
71
+ requirement: !ruby/object:Gem::Requirement
51
72
  requirements:
52
- - - ! '>='
73
+ - - '>='
53
74
  - !ruby/object:Gem::Version
54
75
  version: '0'
55
76
  type: :development
56
77
  prerelease: false
57
- version_requirements: *70198104733860
58
- description: Add some nice Rails 3 ActiveRecord validators.
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Add some nice ActiveRecord validators.
59
84
  email:
60
85
  - fnando.vieira@gmail.com
61
86
  executables: []
@@ -94,46 +119,26 @@ files:
94
119
  - validators.gemspec
95
120
  homepage: http://rubygems.org/gems/validators
96
121
  licenses: []
122
+ metadata: {}
97
123
  post_install_message:
98
124
  rdoc_options: []
99
125
  require_paths:
100
126
  - lib
101
127
  required_ruby_version: !ruby/object:Gem::Requirement
102
- none: false
103
128
  requirements:
104
- - - ! '>='
129
+ - - '>='
105
130
  - !ruby/object:Gem::Version
106
- version: '0'
107
- segments:
108
- - 0
109
- hash: -3805126046563644054
131
+ version: '1.9'
110
132
  required_rubygems_version: !ruby/object:Gem::Requirement
111
- none: false
112
133
  requirements:
113
- - - ! '>='
134
+ - - '>='
114
135
  - !ruby/object:Gem::Version
115
136
  version: '0'
116
- segments:
117
- - 0
118
- hash: -3805126046563644054
119
137
  requirements: []
120
138
  rubyforge_project:
121
- rubygems_version: 1.8.11
139
+ rubygems_version: 2.0.3
122
140
  signing_key:
123
- specification_version: 3
124
- summary: Add some nice Rails 3 ActiveRecord validators.
125
- test_files:
126
- - spec/schema.rb
127
- - spec/spec_helper.rb
128
- - spec/support/dates.rb
129
- - spec/support/emails.rb
130
- - spec/support/ips.rb
131
- - spec/support/models.rb
132
- - spec/support/translations.yml
133
- - spec/support/urls.rb
134
- - spec/validators/ip_spec.rb
135
- - spec/validators/validates_datetime_spec.rb
136
- - spec/validators/validates_email_format_of_spec.rb
137
- - spec/validators/validates_ip_address_spec.rb
138
- - spec/validators/validates_ownership_of_spec.rb
139
- - spec/validators/validates_url_format_of_spec.rb
141
+ specification_version: 4
142
+ summary: Add some nice ActiveRecord validators.
143
+ test_files: []
144
+ has_rdoc: