validates_email_format_of 1.8.0 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2329a74ad3d6ce656ab392715c9c2cbda4c4af6fbffcce69f5e98afd8018f0ae
4
- data.tar.gz: 4ad12aef8277878f61c32a82b231d58251fe2e674ed262a021814075e9df2b17
3
+ metadata.gz: 11c21b2a28ee1659e6727cc106aaf912487adf9b519eceeebd68f3dbb1750b88
4
+ data.tar.gz: 8db0acd0c16c49e5042640bf159aa75caad8f75b899a5df91527d66c899012aa
5
5
  SHA512:
6
- metadata.gz: b454131a1c1f7ded070a65144ccbb9a27add0efa96ce681b578d9e7497f39234b1985863327a51e2179752dc06b9586978c762accaf5daea7e600df34cf11599
7
- data.tar.gz: 76badfe2f7d9b8b75142c2f9b369f485d5b0cd6d3db660206e120bd9eb426f1ed8bd089e58bcb9651c64e5e47ea589eef8c040021da8adb3635957e1f1e3fd27
6
+ metadata.gz: c3fcec1122983e8bbcff3e8a388260d040851467dbb89d6a1157e38ab59fbe908c3b8c69793ac2166ee1cedaf1d78d0c6613fc4ac8c450fb523c45fda1821b59
7
+ data.tar.gz: dbc08e3633edf9d254e80d6614795a36f4c806046aa6dafb1c0aa46e9aa729f19701fbf533be9253138d119b35c8203fdea1a64a87c6c364e0e53ded94e23a7c
@@ -1,7 +1,6 @@
1
1
  name: CI
2
2
 
3
3
  on:
4
- - push
5
4
  - pull_request
6
5
 
7
6
  permissions:
@@ -15,7 +14,7 @@ jobs:
15
14
 
16
15
  strategy:
17
16
  matrix:
18
- ruby: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3"]
17
+ ruby: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "jruby-head"]
19
18
  gemfile: ["4.2", "5.0", "5.1", "5.2", "6.0", "6.1", "7.0", "7.1"]
20
19
 
21
20
  exclude:
@@ -27,6 +26,8 @@ jobs:
27
26
  ruby: "3.2"
28
27
  - gemfile: "4.2"
29
28
  ruby: "3.3"
29
+ - gemfile: "4.2"
30
+ ruby: "jruby-head"
30
31
  - gemfile: "5.0"
31
32
  ruby: "3.0"
32
33
  - gemfile: "5.0"
@@ -35,6 +36,8 @@ jobs:
35
36
  ruby: "3.2"
36
37
  - gemfile: "5.0"
37
38
  ruby: "3.3"
39
+ - gemfile: "5.0"
40
+ ruby: "jruby-head"
38
41
  - gemfile: "5.1"
39
42
  ruby: "3.0"
40
43
  - gemfile: "5.1"
@@ -43,6 +46,8 @@ jobs:
43
46
  ruby: "3.2"
44
47
  - gemfile: "5.1"
45
48
  ruby: "3.3"
49
+ - gemfile: "5.1"
50
+ ruby: "jruby-head"
46
51
  - gemfile: "5.2"
47
52
  ruby: "3.0"
48
53
  - gemfile: "5.2"
@@ -51,6 +56,8 @@ jobs:
51
56
  ruby: "3.2"
52
57
  - gemfile: "5.2"
53
58
  ruby: "3.3"
59
+ - gemfile: "5.2"
60
+ ruby: "jruby-head"
54
61
  - gemfile: "6.0"
55
62
  ruby: "3.2"
56
63
  - gemfile: "6.0"
data/CHANGELOG.md CHANGED
@@ -2,7 +2,20 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
- [Unreleased]: https://github.com/validates-email-format-of/validates_email_format_of/compare/v1.8.0...master
5
+ [Unreleased]: https://github.com/validates-email-format-of/validates_email_format_of/compare/v1.8.2...master
6
+
7
+ ## [1.8.2]
8
+
9
+ * Improve German translations - https://github.com/validates-email-format-of/validates_email_format_of/pull/111
10
+
11
+ [1.8.2]: https://github.com/validates-email-format-of/validates_email_format_of/compare/v1.8.1...1.8.2
12
+
13
+ ## [1.8.1]
14
+
15
+ * Fix IDN->Punycode conversion when domain names start with periods - https://github.com/validates-email-format-of/validates_email_format_of/issues/109
16
+ * Add jruby to test matrix - https://github.com/validates-email-format-of/validates_email_format_of/pull/108
17
+
18
+ [1.8.1]: https://github.com/validates-email-format-of/validates_email_format_of/compare/v1.8.0...1.8.1
6
19
 
7
20
  ## [1.8.0]
8
21
 
@@ -13,13 +26,13 @@
13
26
  * ⚠️ Deprecate `:with` option - https://github.com/validates-email-format-of/validates_email_format_of/issues/42
14
27
  * Require i18n >= 0.8.0 in modern Ruby versions - https://github.com/advisories/GHSA-34hf-g744-jw64
15
28
 
16
- [Unreleased]: https://github.com/validates-email-format-of/validates_email_format_of/compare/v1.7.2...master
29
+ [1.8.0]: https://github.com/validates-email-format-of/validates_email_format_of/compare/v1.7.2...1.8.0
17
30
 
18
31
  ## [1.7.2]
19
32
 
20
33
  * Fix regression that disallowed domains starting with number - https://github.com/validates-email-format-of/validates_email_format_of/issues/88
21
34
 
22
- [Unreleased]: https://github.com/validates-email-format-of/validates_email_format_of/compare/v1.7.1...v1.7.2
35
+ [1.7.2]: https://github.com/validates-email-format-of/validates_email_format_of/compare/v1.7.1...v1.7.2
23
36
 
24
37
  ## [1.7.1] (3 Aug 2022)
25
38
 
data/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  [![Build Status](https://github.com/validates-email-format-of/validates_email_format_of/actions/workflows/ci.yml/badge.svg)]( https://github.com/validates-email-format-of/validates_email_format_of/actions/workflows/ci.yml?query=branch%3Amaster)
4
4
 
5
- A Ruby gem to validate email addresses against RFC 2822 and RFC 5322.
5
+ A Ruby gem to validate email addresses against RFC 2822 and RFC 5322, with optional domain name lookups.
6
6
 
7
7
  ## Why this email validator?
8
8
 
9
9
  This gem is the O.G. email validation gem for Rails. It was started back in 2006.
10
10
 
11
- Why use this validator? Instead of trying to validate email addresses with one giant regular expression, this library parses addresses character by character. This lets us handle weird cases like [nested comments](https://www.rfc-editor.org/rfc/rfc5322#appendix-A.5). Gross but technically allowed.
11
+ Why use this validator? Instead of trying to validate email addresses with one giant regular expression, this library parses addresses character by character. This lets us handle weird cases like [nested comments](https://www.rfc-editor.org/rfc/rfc5322#appendix-A.5). Gross, but technically allowed.
12
12
 
13
13
  In reality, most email validating scripts will get you where you need to go. This library just aims to go all the way.
14
14
 
@@ -45,14 +45,23 @@ end
45
45
  ### Usage without Rails
46
46
 
47
47
  ```ruby
48
+ ValidatesEmailFormatOf::validate_email_format("example@mydomain.com") # => nil
49
+ ValidatesEmailFormatOf::validate_email_format("invalid@") # => ["does not appear to be a valid email address"]
50
+
48
51
  # Optional, if you want error messages to be in your language
49
52
  ValidatesEmailFormatOf::load_i18n_locales
50
53
  I18n.locale = :pl
51
54
 
52
- ValidatesEmailFormatOf::validate_email_format("example@mydomain.com") # => nil
53
- ValidatesEmailFormatOf::validate_email_format("invalid@") # => ["does not appear to be a valid email address"]
55
+ ValidatesEmailFormatOf::validate_email_format("invalid@") # => ["nieprawidłowy adres email"]
54
56
  ```
55
57
 
58
+ ## Internationalized Domain Names (IDN) and Punycode
59
+
60
+ As of v1.8.0, this gem can validate email addresses using internationalized domain names (like `test@пример.рф`) as well as domains that have already been converted to Punycode code (like `test@xn--test@-3weu6azakd.xn--p1ai`).
61
+
62
+ If you would like to forbid internationalized domains, you can pass the `idn: false` option. Punycode is always accepted.
63
+
64
+
56
65
  ## Options
57
66
 
58
67
  | Option | Type | Description |
@@ -69,7 +78,7 @@ ValidatesEmailFormatOf::validate_email_format("invalid@") # => ["does not appear
69
78
  The standard ActiveModel validation options (`:on`, `:if`, `:unless`, `:allow_nil`, `:allow_blank`, etc...) all work as well when using the gem as part of a Rails application.
70
79
  ## Testing
71
80
 
72
- You can see our [current Ruby and Rails test matrix here](.github/workflows/ci.yml).
81
+ The gem is tested against Rails 4.2 and onward across a bunch of Ruby versions including jruby. You can see our [current Ruby and Rails test matrix here](.github/workflows/ci.yml).
73
82
 
74
83
  To execute the unit tests against [all the Rails versions we support run](gemfiles/) <tt>bundle exec appraisal rspec</tt> or run against an individual version with <tt>bundle exec appraisal rails-6.0 rspec</tt>.
75
84
  ## Contributing
@@ -96,16 +105,16 @@ Yes, our Rspec syntax is that simple!
96
105
 
97
106
  ## Credits
98
107
 
99
- Written by Alex Dunae (dunae.ca), 2006-22.
108
+ Written by [Alex Dunae](https://dunae.ca), 2006-24.
100
109
 
101
110
  Many thanks to the plugin's recent contributors: https://github.com/alexdunae/validates_email_format_of/contributors
102
111
 
103
- Thanks to Francis Hwang (http://fhwang.net/) at Diversion Media for creating the 1.1 update.
112
+ Thanks to [Francis Hwang](http://fhwang.net/) at Diversion Media for creating the 1.1 update.
104
113
 
105
114
  Thanks to Travis Sinnott for creating the 1.3 update.
106
115
 
107
- Thanks to Denis Ahearn at Riverock Technologies (http://www.riverocktech.com/) for creating the 1.4 update.
116
+ Thanks to Denis Ahearn at [Riverock Technologies](http://www.riverocktech.com/) for creating the 1.4 update.
108
117
 
109
- Thanks to George Anderson (http://github.com/george) and 'history' (http://github.com/history) for creating the 1.4.1 update.
118
+ Thanks to [George Anderson](http://github.com/george) and ['history'](http://github.com/history) for creating the 1.4.1 update.
110
119
 
111
- Thanks to Isaac Betesh (https://github.com/betesh) for converting tests to Rspec and refactoring for version 1.6.0.
120
+ Thanks to [Isaac Betesh](https://github.com/betesh) for converting tests to Rspec and refactoring for version 1.6.0.
@@ -2,7 +2,7 @@ de:
2
2
  activemodel: &errors
3
3
  errors:
4
4
  messages:
5
- invalid_email_address: 'ist offensichtlich keine gültige EMail-Adresse'
5
+ invalid_email_address: 'ist anscheinend keine gültige E-Mail-Adresse'
6
6
  email_address_not_routable: 'kann nicht erreicht werden'
7
7
  activerecord:
8
8
  <<: *errors
@@ -1,3 +1,3 @@
1
1
  module ValidatesEmailFormatOf
2
- VERSION = "1.8.0"
2
+ VERSION = "1.8.2"
3
3
  end
@@ -269,8 +269,8 @@ module ValidatesEmailFormatOf
269
269
  end
270
270
 
271
271
  def self.validate_domain_part_syntax(domain, idn: true)
272
- domain = SimpleIDN.to_ascii(domain) if idn
273
272
  parts = domain.downcase.split(".", -1)
273
+ parts.map! { |part| SimpleIDN.to_ascii(part) } if idn
274
274
 
275
275
  return false if parts.length <= 1 # Only one domain part
276
276
 
@@ -299,7 +299,7 @@ module ValidatesEmailFormatOf
299
299
  if defined?(ActiveSupport::Deprecation)
300
300
  ActiveSupport::Deprecation.warn(msg)
301
301
  else
302
- warn
302
+ warn(msg)
303
303
  end
304
304
  end
305
305
  end
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  require "active_model"
2
2
  require "active_support"
3
- require "pry"
4
- require "byebug"
5
3
 
6
4
  RSpec::Matchers.define :have_errors_on_email do
7
5
  match do |user|
@@ -140,7 +140,8 @@ describe ValidatesEmailFormatOf do
140
140
  "\nnewline@example.com",
141
141
  " spacesbefore@example.com",
142
142
  "spacesafter@example.com ",
143
- "(unbalancedcomment@example.com"
143
+ "(unbalancedcomment@example.com",
144
+ "help@.example.co.uk" # TLD can not start with a period
144
145
  ].each do |address|
145
146
  describe address do
146
147
  it { should have_errors_on_email.because("does not appear to be a valid email address") }
@@ -203,7 +204,8 @@ describe ValidatesEmailFormatOf do
203
204
 
204
205
  describe "when idn support is enabled" do
205
206
  before(:each) do
206
- allow(SimpleIDN).to receive(:to_ascii).once.with("exämple.com").and_return("xn--exmple-cua.com")
207
+ expect(SimpleIDN).to receive(:to_ascii).with("exämple").and_return("xn--exmple-cua")
208
+ expect(SimpleIDN).to receive(:to_ascii).with("com").and_return("com")
207
209
  end
208
210
  let(:options) { {idn: true} }
209
211
  describe "test@exämple.com" do
@@ -25,5 +25,4 @@ Gem::Specification.new do |s|
25
25
  s.add_development_dependency "rspec"
26
26
  s.add_development_dependency "standard"
27
27
  s.add_development_dependency "appraisal"
28
- s.add_development_dependency "pry-byebug"
29
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validates_email_format_of
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Dunae
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-03-11 00:00:00.000000000 Z
12
+ date: 2024-04-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
@@ -109,20 +109,6 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
- - !ruby/object:Gem::Dependency
113
- name: pry-byebug
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- version: '0'
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
112
  description: Validate email addresses against RFC 2822 and RFC 3696.
127
113
  email:
128
114
  - code@dunae.ca
@@ -187,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
173
  - !ruby/object:Gem::Version
188
174
  version: '0'
189
175
  requirements: []
190
- rubygems_version: 3.4.21
176
+ rubygems_version: 3.3.26
191
177
  signing_key:
192
178
  specification_version: 4
193
179
  summary: Validate email addresses against RFC 2822 and RFC 3696.