email_validator 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4d15cdeca6720498d1bdd8dc2d3a07db1cafb8c5
4
+ data.tar.gz: bf391b40bf7e65cbd21c73e438fb30cf8d8ecac7
5
+ SHA512:
6
+ metadata.gz: f6da0bd3866fb08aa5083853d8f67c392d328fa7590d641dc970025e6b5ece0d56b07be73e9edb8c9cd7d12af9c130f319e8553ffe59e46cb8c61563167cf058
7
+ data.tar.gz: 295f35413dcb7b7eaef6ce56856ca8aa9651bad8c6cf65c6b3196de049630385e6cc5efdb4b49a170d203e96ad4605e4164556898e23768cf0dc6a84910b9524
data/.gitignore CHANGED
@@ -14,6 +14,7 @@ tmtags
14
14
  *.swp
15
15
 
16
16
  ## PROJECT::GENERAL
17
+ Gemfile.lock
17
18
  coverage
18
19
  rdoc
19
20
  pkg
@@ -2,4 +2,7 @@ rvm:
2
2
  - 1.8.7
3
3
  - 1.9.2
4
4
  - 1.9.3
5
- - jruby
5
+ - 2.0.0
6
+ - jruby-18mode
7
+ - jruby-19mode
8
+ - ree
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
@@ -0,0 +1,46 @@
1
+ [![Build Status](https://secure.travis-ci.org/balexand/email_validator.png)](http://travis-ci.org/balexand/email_validator)
2
+
3
+ ## Usage
4
+
5
+ Add to your Gemfile:
6
+
7
+ ```ruby
8
+ gem 'email_validator'
9
+ ```
10
+
11
+ Run:
12
+
13
+ ```
14
+ bundle install
15
+ ```
16
+
17
+ Then add the following to your model:
18
+
19
+ ```ruby
20
+ validates :my_email_attribute, :email => true
21
+ ```
22
+
23
+ ## Strict mode
24
+
25
+ In order to have stricter validation (according to http://www.remote.org/jochen/mail/info/chars.html) enable strict mode. You can do this globally by adding the following to your Gemfile:
26
+
27
+ ```ruby
28
+ gem 'email_validator', :require => 'email_validator/strict'
29
+ ```
30
+
31
+ Or you can do this in a specific `validates` call:
32
+
33
+ ```ruby
34
+ validates :my_email_attribute, :email => {:strict_mode => true}
35
+ ```
36
+
37
+ ## Thread safety
38
+
39
+ This gem is thread safe, with one caveat: `EmailValidator.default_options` must be configured before use in a multi-threaded environment. If you configure `default_options` in a Rails initializer file, then you're good to go since initializers are run before worker threads are spawned.
40
+
41
+ ## Credit
42
+
43
+ Based on http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3
44
+
45
+ Regular Expression based on http://fightingforalostcause.net/misc/2006/compare-email-regex.php tests.
46
+
@@ -1,20 +1,21 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{email_validator}
3
- s.version = "1.3.0"
3
+ s.version = "1.4.0"
4
4
  s.authors = ["Brian Alexander"]
5
- s.date = %q{2011-07-23}
6
- s.description = %q{An email validator for Rails 3. See homepage for details: http://github.com/balexand/email_validator}
5
+ s.description = %q{An email validator for Rails 3+. See homepage for details: http://github.com/balexand/email_validator}
7
6
  s.email = %q{balexand@gmail.com}
8
7
  s.extra_rdoc_files = [
9
8
  "LICENSE",
10
- "README.rdoc"
11
9
  ]
12
10
  s.files = `git ls-files`.split("\n")
13
11
  s.test_files = `git ls-files -- {spec}/*`.split("\n")
14
- s.homepage = %q{http://github.com/balexand/email_validator}
12
+
13
+ s.homepage = %q{https://github.com/balexand/email_validator}
15
14
  s.require_paths = %w(lib)
16
- s.summary = %q{An email validator for Rails 3.}
15
+ s.summary = %q{An email validator for Rails 3+.}
16
+
17
17
  s.add_dependency("activemodel", ">= 0")
18
+
18
19
  s.add_development_dependency("rake")
19
20
  s.add_development_dependency("rspec", ">= 0")
20
21
  end
@@ -9,7 +9,7 @@ class EmailValidator < ActiveModel::EachValidator
9
9
  def validate_each(record, attribute, value)
10
10
  options = @@default_options.merge(self.options)
11
11
  name_validation = options[:strict_mode] ? "-a-z0-9+._" : "^@\\s"
12
- unless value =~ /^\s*([#{name_validation}]{1,64})@((?:[-a-z0-9]+\.)+[a-z]{2,})\s*$/i
12
+ unless value =~ /\A\s*([#{name_validation}]{1,64})@((?:[-a-z0-9]+\.)+[a-z]{2,})\s*\z/i
13
13
  record.errors.add(attribute, options[:message] || :invalid)
14
14
  end
15
15
  end
@@ -84,7 +84,8 @@ describe EmailValidator do
84
84
  "invalid-ip@127.0.0.1.26",
85
85
  "another-invalid-ip@127.0.0.256",
86
86
  "IP-and-port@127.0.0.1:25",
87
- "the-local-part-is-invalid-if-it-is-longer-than-sixty-four-characters@sld.net"
87
+ "the-local-part-is-invalid-if-it-is-longer-than-sixty-four-characters@sld.net",
88
+ "user@example.com\n<script>alert('hello')</script>"
88
89
  ].each do |email|
89
90
 
90
91
  it "#{email.inspect} should not be valid" do
@@ -163,4 +164,4 @@ describe EmailValidator do
163
164
  end
164
165
  end
165
166
  end
166
- end
167
+ end
metadata CHANGED
@@ -1,92 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
5
- prerelease:
4
+ version: 1.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brian Alexander
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-07-23 00:00:00.000000000 Z
11
+ date: 2013-03-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activemodel
16
- requirement: &70351238018900 !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: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70351238018900
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: rake
27
- requirement: &70351238018180 !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
33
  version: '0'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *70351238018180
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: rspec
38
- requirement: &70351238017440 !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: *70351238017440
47
- description: ! 'An email validator for Rails 3. See homepage for details: http://github.com/balexand/email_validator'
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: 'An email validator for Rails 3+. See homepage for details: http://github.com/balexand/email_validator'
48
56
  email: balexand@gmail.com
49
57
  executables: []
50
58
  extensions: []
51
59
  extra_rdoc_files:
52
60
  - LICENSE
53
- - README.rdoc
54
61
  files:
55
62
  - .document
56
63
  - .gitignore
57
64
  - .travis.yml
58
65
  - Gemfile
59
- - Gemfile.lock
60
66
  - LICENSE
61
- - README.rdoc
67
+ - README.md
62
68
  - Rakefile
63
69
  - email_validator.gemspec
64
70
  - lib/email_validator.rb
65
71
  - lib/email_validator/strict.rb
66
72
  - spec/email_validator_spec.rb
67
73
  - spec/spec_helper.rb
68
- homepage: http://github.com/balexand/email_validator
74
+ homepage: https://github.com/balexand/email_validator
69
75
  licenses: []
76
+ metadata: {}
70
77
  post_install_message:
71
78
  rdoc_options: []
72
79
  require_paths:
73
80
  - lib
74
81
  required_ruby_version: !ruby/object:Gem::Requirement
75
- none: false
76
82
  requirements:
77
- - - ! '>='
83
+ - - '>='
78
84
  - !ruby/object:Gem::Version
79
85
  version: '0'
80
86
  required_rubygems_version: !ruby/object:Gem::Requirement
81
- none: false
82
87
  requirements:
83
- - - ! '>='
88
+ - - '>='
84
89
  - !ruby/object:Gem::Version
85
90
  version: '0'
86
91
  requirements: []
87
92
  rubyforge_project:
88
- rubygems_version: 1.8.10
93
+ rubygems_version: 2.0.0
89
94
  signing_key:
90
- specification_version: 3
91
- summary: An email validator for Rails 3.
95
+ specification_version: 4
96
+ summary: An email validator for Rails 3+.
92
97
  test_files: []
@@ -1,36 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- email_validator (1.2.4)
5
- activemodel
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- activemodel (3.1.3)
11
- activesupport (= 3.1.3)
12
- builder (~> 3.0.0)
13
- i18n (~> 0.6)
14
- activesupport (3.1.3)
15
- multi_json (~> 1.0)
16
- builder (3.0.0)
17
- diff-lcs (1.1.3)
18
- i18n (0.6.0)
19
- multi_json (1.0.4)
20
- rake (0.9.2.2)
21
- rspec (2.7.0)
22
- rspec-core (~> 2.7.0)
23
- rspec-expectations (~> 2.7.0)
24
- rspec-mocks (~> 2.7.0)
25
- rspec-core (2.7.1)
26
- rspec-expectations (2.7.0)
27
- diff-lcs (~> 1.1.2)
28
- rspec-mocks (2.7.0)
29
-
30
- PLATFORMS
31
- ruby
32
-
33
- DEPENDENCIES
34
- email_validator!
35
- rake
36
- rspec
@@ -1,31 +0,0 @@
1
- {<img src="https://secure.travis-ci.org/balexand/email_validator.png" />}[http://travis-ci.org/balexand/email_validator]
2
-
3
- == Usage
4
-
5
- Add to your Gemfile:
6
-
7
- gem 'email_validator'
8
-
9
- Run:
10
-
11
- bundle install
12
-
13
- Then add the following to your model:
14
-
15
- validates :my_email_attribute, :email => true
16
-
17
- == Strict mode
18
-
19
- In order to have stricter validation (according to http://www.remote.org/jochen/mail/info/chars.html) enable strict mode. You can do this globally by adding the following to your Gemfile:
20
-
21
- gem 'email_validator', :require => 'email_validator/strict'
22
-
23
- Or you can do this in a specific `validates` call:
24
-
25
- validates :my_email_attribute, :email => {:strict_mode => true}
26
-
27
- == Credit
28
-
29
- Based on http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3
30
- Regular Expression based on http://fightingforalostcause.net/misc/2006/compare-email-regex.php tests.
31
-