email_typo 0.1.1 → 0.2.3

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: 1b2bb8b32af16302a1fbc103c69d81fc49b8586eaf04828f6f5805b060ad319e
4
- data.tar.gz: 415393c2f3fe10f979641799f75735b0ac89ed1ee020d898e2d5f2d52f9fd87c
3
+ metadata.gz: efa2ec563a56461dcd879a22a93f23db4153e552da434ab958a2756b9a6bd366
4
+ data.tar.gz: f433a26872669bd05c154e21bb6f4de2d98e438ad133d098d8edafee2dc33217
5
5
  SHA512:
6
- metadata.gz: a6ec7d969ce82f3f10e6fbdd5b1da4a592a2cdfa8c734064d9618a4186d59d406d61fbb0a83bdc74ab92087004865579ac566bb41302d9293abdb6db6da7918c
7
- data.tar.gz: 4b920c7ceb864f4976d266174d65f8b141e376dd842d9ea4bffb513e08dd5d9718fa0b77f46825c0664daedef1402efe886a3a955ee63a74ebb4c5e298913b61
6
+ metadata.gz: e277ece3460063a25bc27a0c561f06cc9fc3d917afb10579e855ef4874db775c58ce43bc010ddaa433766fe1bcd277f728e9c003170fa534c17105b8c27ffc1d
7
+ data.tar.gz: 06a00156afe49f489c65bcb67a69babe652ba432f41465641138cbb4b7fe9e23af384a918543080d1884420263d18fa3a46b22cc419ad541e036502bbb3c5b68
@@ -0,0 +1,4 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [fnando]
4
+ custom: ["https://paypal.me/nandovieira/🍕"]
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: "🐛 Bug Report"
3
+ about: Report a reproducible bug or regression.
4
+ title: 'Bug: '
5
+ labels: 'Status: Unconfirmed'
6
+
7
+ ---
8
+
9
+ <!--
10
+ - Please provide a clear and concise description of what the bug is.
11
+ - If possible, add an example reproducing your issue.
12
+ - Please test using the latest version of email_typo
13
+ to make sure your issue has not already been fixed.
14
+ -->
15
+
16
+ ## Description
17
+
18
+ [Add bug description here]
19
+
20
+ ## How to reproduce
21
+
22
+ [Add steps on how to reproduce this issue]
23
+
24
+ ## What do you expect
25
+
26
+ [Describe what do you expect to happen]
27
+
28
+ ## What happened instead
29
+
30
+ [Describe the actual results]
31
+
32
+ ## Software:
33
+
34
+ - Gem version: [Add gem version here]
35
+ - Ruby version: [Add version here]
36
+
37
+ ## Full backtrace
38
+
39
+ ```text
40
+ [Paste full backtrace here]
41
+ ```
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: "💡 Feature request"
3
+ about: Have an idea that may be useful? Make a suggestion!
4
+ title: 'Feature Request: '
5
+ labels: 'Feature request'
6
+
7
+ ---
8
+
9
+ ## Description
10
+
11
+ _A clear and concise description of what the problem is._
12
+
13
+ ## Describe the solution
14
+
15
+ _A clear and concise description of what you want to happen._
16
+
17
+ ## Alternatives you considered
18
+
19
+ _A clear and concise description of any alternative solutions or features you've considered._
20
+
21
+ ## Additional context
22
+
23
+ _Add any other context, screenshots, links, etc about the feature request here._
@@ -0,0 +1,38 @@
1
+ <!--
2
+ If you're making a doc PR or something tiny where the below is irrelevant,
3
+ delete this template and use a short description, but in your description aim to
4
+ include both what the change is, and why it is being made, with enough context
5
+ for anyone to understand.
6
+ -->
7
+
8
+ <details>
9
+ <summary>PR Checklist</summary>
10
+
11
+ ### PR Structure
12
+
13
+ - [ ] This PR has reasonably narrow scope (if not, break it down into smaller
14
+ PRs).
15
+ - [ ] This PR avoids mixing refactoring changes with feature changes (split into
16
+ two PRs otherwise).
17
+ - [ ] This PR's title starts is concise and descriptive.
18
+
19
+ ### Thoroughness
20
+
21
+ - [ ] This PR adds tests for the most critical parts of the new functionality or
22
+ fixes.
23
+ - [ ] I've updated any docs, `.md` files, etc… affected by this change.
24
+
25
+ </details>
26
+
27
+ ### What
28
+
29
+ [TODO: Short statement about what is changing.]
30
+
31
+ ### Why
32
+
33
+ [TODO: Why this change is being made. Include any context required to understand
34
+ the why.]
35
+
36
+ ### Known limitations
37
+
38
+ [TODO or N/A]
@@ -0,0 +1,15 @@
1
+ ---
2
+ # Documentation:
3
+ # https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates
4
+
5
+ version: 2
6
+ updates:
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "daily"
11
+
12
+ - package-ecosystem: "bundler"
13
+ directory: "/"
14
+ schedule:
15
+ interval: "daily"
@@ -0,0 +1,55 @@
1
+ name: Tests
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ push:
8
+ branches:
9
+ - main
10
+
11
+ schedule:
12
+ - cron: "0 10 * * *"
13
+
14
+ jobs:
15
+ build:
16
+ name: Tests with Ruby ${{ matrix.ruby }} and ${{ matrix.gemfile }}
17
+ runs-on: "ubuntu-latest"
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ ruby: [2.6.x, 2.7.x]
22
+ gemfile:
23
+ - Gemfile
24
+
25
+ steps:
26
+ - uses: actions/checkout@v1
27
+
28
+ - uses: actions/cache@v2
29
+ with:
30
+ path: vendor/bundle
31
+ key: >
32
+ ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
33
+ restore-keys: >
34
+ ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
35
+
36
+ - name: Set up Ruby
37
+ uses: actions/setup-ruby@v1
38
+ with:
39
+ ruby-version: ${{ matrix.ruby }}
40
+
41
+ - name: Install gem dependencies
42
+ env:
43
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
44
+ run: |
45
+ gem install bundler
46
+ bundle config path vendor/bundle
47
+ bundle update --jobs 4 --retry 3
48
+
49
+ - name: Run Tests
50
+ env:
51
+ PGHOST: localhost
52
+ PGUSER: postgres
53
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
54
+ run: |
55
+ bundle exec rake
@@ -1,126 +1,7 @@
1
- AllCops:
2
- Exclude:
3
- - "bin/**/*"
4
- - "gemfiles/**/*"
5
- - "vendor/**/*"
6
- - "Gemfile"
7
- - "Rakefile"
8
- - "*.gemspec"
9
- - "config.ru"
10
-
11
- Style/Alias:
12
- EnforcedStyle: prefer_alias_method
13
-
14
- Style/FrozenStringLiteralComment:
15
- EnforcedStyle: always
16
-
17
- Style/ClassCheck:
18
- EnforcedStyle: kind_of?
19
-
20
- Metrics/LineLength:
21
- Max: 80
22
-
23
- Style/BlockDelimiters:
24
- Enabled: false
25
-
26
- Style/RegexpLiteral:
27
- Enabled: false
28
-
29
- Metrics/AbcSize:
30
- Enabled: false
31
-
32
- Style/PerlBackrefs:
33
- Enabled: false
34
-
35
- ClassLength:
36
- Enabled: false
37
-
38
- CyclomaticComplexity:
39
- Enabled: false
40
-
41
- Documentation:
42
- Enabled: false
43
-
44
- Encoding:
45
- Enabled: false
46
-
47
- FileName:
48
- Enabled: false
49
-
50
- IfUnlessModifier:
51
- Enabled: false
52
-
53
- MethodLength:
54
- Enabled: false
55
-
56
- ModuleFunction:
57
- Enabled: false
1
+ ---
2
+ inherit_gem:
3
+ rubocop-fnando: .rubocop.yml
58
4
 
59
- OneLineConditional:
60
- Enabled: false
61
-
62
- ParameterLists:
63
- Enabled: false
64
-
65
- Proc:
66
- Enabled: false
67
-
68
- SingleLineBlockParams:
69
- Enabled: false
70
-
71
- VariableInterpolation:
72
- Enabled: false
73
-
74
- Style/TrailingCommaInLiteral:
75
- Enabled: false
76
-
77
- WhileUntilModifier:
78
- Enabled: false
79
-
80
- PredicateName:
81
- NamePrefixBlacklist:
82
- - is_
83
-
84
- StringLiterals:
85
- EnforcedStyle: double_quotes
86
- SupportedStyles:
87
- - single_quotes
88
- - double_quotes
89
-
90
- DotPosition:
91
- EnforcedStyle: leading
92
-
93
- SpaceBeforeBlockBraces:
94
- EnforcedStyle: space
95
-
96
- SpaceInsideBlockBraces:
97
- EnforcedStyle: no_space
98
-
99
- DoubleNegation:
100
- Enabled: false
101
-
102
- SpaceInsideBlockBraces:
103
- SpaceBeforeBlockParameters: false
104
-
105
- SpaceInsideHashLiteralBraces:
106
- Enabled: false
107
-
108
- PercentLiteralDelimiters:
109
- PreferredDelimiters:
110
- '%': '[]'
111
- '%i': '[]'
112
- '%q': '[]'
113
- '%Q': '[]'
114
- '%r': '[]'
115
- '%s': '[]'
116
- '%w': '[]'
117
- '%W': '[]'
118
- '%x': '[]'
119
-
120
- Style/CollectionMethods:
121
- PreferredMethods:
122
- collect: 'map'
123
- collect!: 'map!'
124
- inject: 'reduce'
125
- detect: 'find'
126
- find_all: 'select'
5
+ AllCops:
6
+ TargetRubyVersion: 2.6
7
+ NewCops: enable
@@ -1,18 +1,19 @@
1
+ ---
1
2
  sudo: false
2
3
  cache: bundler
3
4
  language: ruby
4
5
  rvm:
5
- - 2.5.2
6
+ - "2.7"
6
7
  before_install: gem install bundler
7
8
  script: bundle exec rake
8
9
  notifications:
9
10
  email: false
10
11
  before_script:
11
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
12
- - chmod +x ./cc-test-reporter
13
- - "./cc-test-reporter before-build"
12
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
13
+ - chmod +x ./cc-test-reporter
14
+ - "./cc-test-reporter before-build"
14
15
  after_script:
15
- - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
16
+ - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
16
17
  env:
17
18
  global:
18
19
  secure: XU0SxxhufYnJNYC88bsAHseHtK4fd12B97b7NwHxnND9dDbUPCuGI9mkt06wTZchWnB4nDuS4SF6ib73zAP1JI3m7f2FyazAqrgm/OneXy8GYVQtbrG2+1XObSMc7ONX8K/+VGVnZi2nHO3XyC7VRWQreppVK8U24P7qNpJzmWUTy8XqvJT0ZTupELhbikh1cY1np/ammV4eX6QwoeSDd0Wx5QM4D/P06NEXqQ7PdYBBIDuB8zFwSZLh/Q8wNDiOwcUVJTULh/nLmdGMclCcp/aRPrbbWk01scS3khqiJK8SfujeDYNJeuaECGm/9r9MZHvH9Qd88aUJBZcxJRXJiZJ6xuYvc7WnF8tNxGp8xNYTr9/YJrUPPMDdoLr50LyXiY1wf3A0dQHdGNIv5gd7pMoEK+kg0dkqcnhg6OQNRkihudbFuORdKRocIVzHgxB3We+FBnqfexgzLNoYU3eJB3IL8nS0dRX2lSP36SDXTkZNUxflDgGLmoz//FRll3WJ1VsGOkZqBPA2TMoRxqLyhaVnXuPS5uiBUu4gAC4df4HWPAtM1LFtI1HvMenKOYFDqjrPqLevtmQTP/72zl84GAA3hoBGnPgOh2GBtAo/nn5ExbWQUfHSYMwSVD3rrMhe5Lt7G6mzg8hkGU7hYOKwrfSUq/i3+omS0gwHEUBh2vQ=
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ <!--
4
+ Prefix your message with one of the following:
5
+
6
+ - [Added] for new features.
7
+ - [Changed] for changes in existing functionality.
8
+ - [Deprecated] for soon-to-be removed features.
9
+ - [Removed] for now removed features.
10
+ - [Fixed] for any bug fixes.
11
+ - [Security] in case of vulnerabilities.
12
+ -->
13
+
14
+ ## Unreleased
15
+
16
+ - Initial release.
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
55
55
  ## Enforcement
56
56
 
57
57
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at fnando.vieira@gmail.com. All
58
+ reported by contacting the project team at me@fnando.com. All
59
59
  complaints will be reviewed and investigated and will result in a response that
60
60
  is deemed necessary and appropriate to the circumstances. The project team is
61
61
  obligated to maintain confidentiality with regard to the reporter of an incident.
@@ -68,7 +68,7 @@ members of the project's leadership.
68
68
  ## Attribution
69
69
 
70
70
  This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
72
 
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
@@ -0,0 +1,79 @@
1
+ # Contributing to email_typo
2
+
3
+ 👍🎉 First off, thanks for taking the time to contribute! 🎉👍
4
+
5
+ The following is a set of guidelines for contributing to this project. These are
6
+ mostly guidelines, not rules. Use your best judgment, and feel free to propose
7
+ changes to this document in a pull request.
8
+
9
+ ## Code of Conduct
10
+
11
+ Everyone interacting in this project's codebases, issue trackers, chat rooms and
12
+ mailing lists is expected to follow the [code of conduct](https://github.com/fnando/email_typo/blob/main/CODE_OF_CONDUCT.md).
13
+
14
+ ## Reporting bugs
15
+
16
+ This section guides you through submitting a bug report. Following these
17
+ guidelines helps maintainers and the community understand your report, reproduce
18
+ the behavior, and find related reports.
19
+
20
+ - Before creating bug reports, please check the open issues; somebody may
21
+ already have submitted something similar, and you may not need to create a new
22
+ one.
23
+ - When you are creating a bug report, please include as many details as
24
+ possible, with an example reproducing the issue.
25
+
26
+ ## Contributing with code
27
+
28
+ Before making any radicals changes, please make sure you discuss your intention
29
+ by [opening an issue on Github](https://github.com/fnando/email_typo/issues).
30
+
31
+ When you're ready to make your pull request, follow checklist below to make sure
32
+ your contribution is according to how this project works.
33
+
34
+ 1. [Fork](https://help.github.com/forking/) email_typo
35
+ 2. Create a topic branch - `git checkout -b my_branch`
36
+ 3. Make your changes using [descriptive commit messages](#commit-messages)
37
+ 4. Update CHANGELOG.md describing your changes by adding an entry to the
38
+ "Unreleased" section. If this section is not available, create one right
39
+ before the last version.
40
+ 5. Push to your branch - `git push origin my_branch`
41
+ 6. [Create a pull request](https://docs.github.com/articles/creating-a-pull-request)
42
+ 7. That's it!
43
+
44
+ ## Styleguides
45
+
46
+ ### Commit messages
47
+
48
+ - Use the present tense ("Add feature" not "Added feature")
49
+ - Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
50
+ - Limit the first line to 72 characters or less
51
+ - Reference issues and pull requests liberally after the first line
52
+
53
+ ### Changelog
54
+
55
+ - Add a message describing your changes to the "Unreleased" section. The
56
+ changelog message should follow the same style as the commit message.
57
+ - Prefix your message with one of the following:
58
+ - `[Added]` for new features.
59
+ - `[Changed]` for changes in existing functionality.
60
+ - `[Deprecated]` for soon-to-be removed features.
61
+ - `[Removed]` for now removed features.
62
+ - `[Fixed]` for any bug fixes.
63
+ - `[Security]` in case of vulnerabilities.
64
+
65
+ ### Ruby code
66
+
67
+ - This project uses [Rubocop](https://rubocop.org) to enforce code style. Before
68
+ submitting your changes, make sure your tests are passing and code conforms to
69
+ the expected style by running `rake`.
70
+ - Do not change the library version. This will be done by the maintainer
71
+ whenever a new version is about to be released.
72
+
73
+ ### JavaScript code
74
+
75
+ - This project uses [ESLint](https://eslint.org) to enforce code style. Before
76
+ submitting your changes, make sure your tests are passing and code conforms to
77
+ the expected style by running `yarn test:ci`.
78
+ - Do not change the library version. This will be done by the maintainer
79
+ whenever a new version is about to be released.
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
- # Specify your gem's dependencies in email_typo.gemspec
4
5
  gemspec
@@ -0,0 +1,20 @@
1
+ # The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Nando Vieira
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,45 +1,49 @@
1
- # EmailTypo
1
+ # email_typo
2
2
 
3
- [![Travis-CI](https://travis-ci.org/fnando/email_typo.svg)](https://travis-ci.org/fnando/email_typo)
3
+ [![Tests](https://github.com/fnando/email_typo/workflows/Tests/badge.svg)](https://github.com/fnando/email_typo)
4
4
  [![Code Climate](https://codeclimate.com/github/fnando/email_typo/badges/gpa.svg)](https://codeclimate.com/github/fnando/email_typo)
5
- [![Test Coverage](https://codeclimate.com/github/fnando/email_typo/badges/coverage.svg)](https://codeclimate.com/github/fnando/email_typo/coverage)
6
5
  [![Gem](https://img.shields.io/gem/v/email_typo.svg)](https://rubygems.org/gems/email_typo)
7
6
  [![Gem](https://img.shields.io/gem/dt/email_typo.svg)](https://rubygems.org/gems/email_typo)
8
7
 
9
- EmailTypo is a Ruby gem that gives you an easy, tested method that fixes email typos.
8
+ EmailTypo is a Ruby gem that gives you an easy, tested method that fixes email
9
+ typos.
10
10
 
11
- As an example: A user with the email "joe@gmail.com" accidentally enters in "joe@gmal.cmo", EmailTypo will fix it automatically.
11
+ As an example: A user with the email "joe@gmail.com" accidentally enters in
12
+ "joe@gmal.cmo", EmailTypo will fix it automatically.
12
13
 
13
- EmailTypo is concerned with incorrectly-entered data (email provider names, TLDs), not with evaluating whether a particular domain is valid, or whether a particular email address is legitimate. (That is, it's focused on fixing the part that comes after the "@" in the email address.) It works really well for helping you — and your users — when they accidentally type something in wrong.
14
+ EmailTypo is concerned with incorrectly-entered data (email provider names,
15
+ TLDs), not with evaluating whether a particular domain is valid, or whether a
16
+ particular email address is legitimate. (That is, it's focused on fixing the
17
+ part that comes after the "@" in the email address.) It works really well for
18
+ helping you — and your users — when they accidentally type something in wrong.
14
19
 
15
- **NOTE**: This is based on https://github.com/charliepark/fat_fingers, but without polluting the `String` class and with easier extension support.
20
+ **NOTE**: This is based on https://github.com/charliepark/fat_fingers, but
21
+ without polluting the `String` class and with easier extension support.
16
22
 
17
23
  ## Installation
18
24
 
19
- Add this line to your application's Gemfile:
25
+ ```bash
26
+ gem install email_typo
27
+ ```
28
+
29
+ Or add the following line to your project's Gemfile:
20
30
 
21
31
  ```ruby
22
32
  gem "email_typo"
23
33
  ```
24
34
 
25
- And then execute:
26
-
27
- $ bundle
28
-
29
- Or install it yourself as:
30
-
31
- $ gem install email_typo
32
-
33
35
  ## Usage
34
36
 
35
- To fix any typos, just use `EmailTypo.fix(email)`.
37
+ To fix any typos, just use `EmailTypo.call(email)`.
36
38
 
37
39
  ```ruby
38
- EmailTypo.fix("john.doe@gmail.co")
40
+ EmailTypo.call("john.doe@gmail.co")
39
41
  #=> "john.doe@gmail.com"
40
42
  ```
41
43
 
42
- To add/change the processors, add any object that responds to `#call(email)` to `EmailTypo.default_processors`. The following example adds a processor for `.uol.com.br`, a Brazilian email provider:
44
+ To add/change the processors, add any object that responds to `#call(email)` to
45
+ `EmailTypo.default_processors`. The following example adds a processor for
46
+ `.uol.com.br`, a Brazilian email provider:
43
47
 
44
48
  ```ruby
45
49
  EmailTypo.default_processors << lambda do |email|
@@ -47,16 +51,27 @@ EmailTypo.default_processors << lambda do |email|
47
51
  end
48
52
  ```
49
53
 
50
- ## Development
54
+ ## Maintainer
55
+
56
+ - [Nando Vieira](https://github.com/fnando)
51
57
 
52
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
58
+ ## Contributors
53
59
 
54
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
60
+ - https://github.com/fnando/email_typo/contributors
55
61
 
56
62
  ## Contributing
57
63
 
58
- Bug reports and pull requests are welcome on GitHub at https://github.com/fnando/email_typo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
64
+ For more details about how to contribute, please read
65
+ https://github.com/fnando/email_typo/blob/main/CONTRIBUTING.md.
59
66
 
60
67
  ## License
61
68
 
62
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
69
+ The gem is available as open source under the terms of the
70
+ [MIT License](https://opensource.org/licenses/MIT). A copy of the license can be
71
+ found at https://github.com/fnando/email_typo/blob/main/LICENSE.md.
72
+
73
+ ## Code of Conduct
74
+
75
+ Everyone interacting in the email_typo project's codebases, issue trackers, chat
76
+ rooms and mailing lists is expected to follow the
77
+ [code of conduct](https://github.com/fnando/email_typo/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rake/testtask"
5
+ require "rubocop/rake_task"
3
6
 
4
7
  Rake::TestTask.new(:test) do |t|
5
8
  t.libs << "test"
@@ -7,4 +10,6 @@ Rake::TestTask.new(:test) do |t|
7
10
  t.test_files = FileList["test/**/*_test.rb"]
8
11
  end
9
12
 
10
- task :default => :test
13
+ RuboCop::RakeTask.new
14
+
15
+ task default: %i[test rubocop]
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "email_typo"
@@ -6,9 +7,10 @@ require "email_typo"
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
8
9
 
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
10
+ begin
11
+ require "pry"
12
+ Pry.start
13
+ rescue LoadError
14
+ require "irb"
15
+ IRB.start(__FILE__)
16
+ end
data/bin/setup CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env bash
2
+
2
3
  set -euo pipefail
4
+
3
5
  IFS=$'\n\t'
4
6
  set -vx
5
7
 
@@ -1,28 +1,46 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "./lib/email_typo/version"
3
+ require_relative "./lib/email_typo/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "email_typo"
7
- spec.version = EmailTypo::VERSION
8
- spec.authors = ["Nando Vieira"]
9
- spec.email = ["fnando.vieira@gmail.com"]
10
-
11
- spec.summary = "Clean up e-mail strings when the user's made a typo (like 'gmail.cmo')."
12
- spec.description = spec.summary
13
- spec.homepage = "https://github.com/fnando/email_typo"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
- f.match(%r{^(test|spec|features)/})
6
+ spec.name = "email_typo"
7
+ spec.version = EmailTypo::VERSION
8
+ spec.authors = ["Nando Vieira"]
9
+ spec.email = ["me@fnando.com"]
10
+
11
+ spec.summary = "Suggest fixes to a misspelled email address, like " \
12
+ "john@gmail.cmo."
13
+ spec.description = spec.summary
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
16
+
17
+ github_url = "https://github.com/fnando/email_typo"
18
+ github_tree_url = "#{github_url}/tree/v#{spec.version}"
19
+
20
+ spec.homepage = github_url
21
+ spec.metadata["homepage_uri"] = spec.homepage
22
+ spec.metadata["bug_tracker_uri"] = "#{github_url}/issues"
23
+ spec.metadata["source_code_uri"] = github_tree_url
24
+ spec.metadata["changelog_uri"] = "#{github_tree_url}/CHANGELOG.md"
25
+ spec.metadata["documentation_uri"] = "#{github_tree_url}/README.md"
26
+ spec.metadata["license_uri"] = "#{github_tree_url}/LICENSE.md"
27
+
28
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
29
+ `git ls-files -z`
30
+ .split("\x0")
31
+ .reject {|f| f.match(%r{^(test|spec|features)/}) }
18
32
  end
33
+
19
34
  spec.bindir = "exe"
20
35
  spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
21
36
  spec.require_paths = ["lib"]
22
37
 
23
- spec.add_development_dependency "bundler"
24
- spec.add_development_dependency "rake"
38
+ spec.add_development_dependency "email_data"
39
+ spec.add_development_dependency "minitest"
25
40
  spec.add_development_dependency "minitest-utils"
26
41
  spec.add_development_dependency "pry-meta"
42
+ spec.add_development_dependency "rake"
43
+ spec.add_development_dependency "rubocop"
44
+ spec.add_development_dependency "rubocop-fnando"
27
45
  spec.add_development_dependency "simplecov"
28
46
  end
@@ -0,0 +1 @@
1
+ 40ccae7c07c87212f1397f92a6f0224373130260
@@ -9,9 +9,12 @@ require_relative "./email_typo/different_tlds"
9
9
  require_relative "./email_typo/dot_com"
10
10
  require_relative "./email_typo/dot_net"
11
11
  require_relative "./email_typo/dot_org"
12
+ require_relative "./email_typo/fix_extraneous_letter_dot_com"
13
+ require_relative "./email_typo/fix_extraneous_numbers"
12
14
  require_relative "./email_typo/gmail"
13
15
  require_relative "./email_typo/googlemail"
14
16
  require_relative "./email_typo/hotmail"
17
+ require_relative "./email_typo/icloud"
15
18
  require_relative "./email_typo/known_dot_com"
16
19
  require_relative "./email_typo/period_around_at_sign"
17
20
  require_relative "./email_typo/providers"
@@ -32,6 +35,8 @@ module EmailTypo
32
35
  TransposedPeriods,
33
36
  PeriodAroundAtSign,
34
37
  DifferentTlds,
38
+ FixExtraneousLetterDotCom,
39
+ FixExtraneousNumbers,
35
40
  AddMissingM,
36
41
  AddMissingPeriod,
37
42
  Providers,
@@ -42,15 +47,21 @@ module EmailTypo
42
47
  Gmail,
43
48
  Googlemail,
44
49
  Hotmail,
50
+ Icloud,
45
51
  KnownDotCom,
46
52
  Yahoo
47
53
  ]
48
54
 
49
- def self.fix(email, processors = default_processors)
55
+ def self.call(email, processors = default_processors)
50
56
  return unless email
51
57
 
52
58
  processors.reduce(email.downcase) do |processed_email, processor|
53
59
  processor.call(processed_email)
54
60
  end
55
61
  end
62
+
63
+ def self.fix(email, processors = default_processors)
64
+ warn "EmailTypo.fix is deprecated; use EmailTypo.call instead."
65
+ call(email, processors)
66
+ end
56
67
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module EmailTypo
4
4
  AddMissingPeriod = lambda do |email|
5
- email.gsub(/([^\.])(com|org|net)$/, "\\1.\\2")
5
+ email.gsub(/([^.])(com|org|net)$/, "\\1.\\2")
6
6
  end
7
7
  end
@@ -3,7 +3,20 @@
3
3
  module EmailTypo
4
4
  DifferentTlds = lambda do |email|
5
5
  email
6
- .gsub(/\.(o\.uk|couk|co\.um)$/, ".co.uk")
7
- .gsub(/\.(cojp|co\.lp)$/, ".co.jp")
6
+ .gsub(/\.(o\.uk|co\.k|couk|co\.u[kmnlj]{0,2})$/, ".co.uk")
7
+ .gsub(/\.(cojp|co\.lp|co\.p)$/, ".co.jp")
8
+ .gsub(/\.(com?br|com?\.[bv]r+)$/, ".com.br")
9
+ .gsub(/\.(r+(u+(?!n).|y)|r)$/, ".ru")
10
+ .gsub(/\.i+t+$/, ".it")
11
+ .gsub(/\.f+[re]+$/, ".fr")
12
+ .gsub(/\.de+(?!v).$/, ".de")
13
+ .gsub(/\.jn$/, ".in")
14
+ .gsub(/\.lde$/, ".de")
15
+ .gsub(/\.oprg$/, ".org")
16
+ .gsub(/\.gob(\b|\.)/, ".gov")
17
+ .gsub(/\.edi?(\b|\.)/, ".edu")
18
+ .gsub(/\.mx.{1,2}$/, ".mx")
19
+ .gsub(/\.[com.]{2,3}ar$/, ".com.ar")
20
+ .gsub(/\.[com.]{2,3}au$/, ".com.au")
8
21
  end
9
22
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  module EmailTypo
4
4
  DotNet = lambda do |email|
5
- email.gsub(/\.(nte*|n*et*)$/, ".net")
5
+ email
6
+ .gsub(/\.(nte*|n*et*|ney)$/, ".net")
7
+ .gsub(/\.met$/, ".net")
6
8
  end
7
9
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EmailTypo
4
+ FixExtraneousLetterDotCom = lambda do |email|
5
+ email
6
+ .gsub(/\..com$/, ".com")
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EmailTypo
4
+ FixExtraneousNumbers = lambda do |email|
5
+ email.gsub(/\.?\d+$/, "")
6
+ end
7
+ end
@@ -2,6 +2,11 @@
2
2
 
3
3
  module EmailTypo
4
4
  Gmail = lambda do |email|
5
- email.gsub(/@g[nm]{0,2}s?[ail]{1,2}[aiklmou]{0,3}\.(?!gov|edu)/, "@gmail.")
5
+ email
6
+ .gsub(
7
+ /@ga?e?i?o?r?g?[nm]{0,2}s?[ail]{1,2}[aiklmou]{0,3}\.(?!gov|edu|ac\.in)/,
8
+ "@gmail."
9
+ )
10
+ .gsub(/@gmail\.(com\.\w+|c)$/, "@gmail.com")
6
11
  end
7
12
  end
@@ -3,6 +3,9 @@
3
3
  module EmailTypo
4
4
  Googlemail = lambda do |email|
5
5
  email
6
- .gsub(/@go{0,3}g{0,2}o?le?[mn]?[ail]{1,2}m?[aikl]{0,3}\./, "@googlemail.")
6
+ .gsub(
7
+ /@go{0,3}g{0,2}o?le?[mn]?[ail]{1,2}m?[aikl]{0,3}\.(?!gov|edu|ac\.in)/,
8
+ "@googlemail."
9
+ )
7
10
  end
8
11
  end
@@ -2,6 +2,12 @@
2
2
 
3
3
  module EmailTypo
4
4
  Hotmail = lambda do |email|
5
- email.gsub(/@h(i|o|p)?y?t?o?a?m?n?t?[aikl]{1,3}l?\./, "@hotmail.")
5
+ email
6
+ .gsub(
7
+ /@h((?!anmail)(i|o|p)?y?t?o?a?r?m?n?t?m?[aikl]{1,3}l?)\./,
8
+ "@hotmail."
9
+ )
10
+ .gsub(/@otmail\.com/, "@hotmail.com")
11
+ .gsub(/@hotmail.com[a-z]+/, "@hotmail.com")
6
12
  end
7
13
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EmailTypo
4
+ Icloud = lambda do |email|
5
+ email.gsub(/@icl{0,2}(?:uo|u|o)?d\./, "@icloud.")
6
+ end
7
+ end
@@ -4,7 +4,7 @@ module EmailTypo
4
4
  KnownDotCom = lambda do |email|
5
5
  email
6
6
  .gsub(
7
- /@(aol|googlemail|gmail|hotmail|yahoo|icloud|outlook)\.([a-z]+)$/,
7
+ /@(aol|googlemail|gmail|hotmail|yahoo|icloud|outlook)\.(co|net|org)$/,
8
8
  "@\\1.com"
9
9
  )
10
10
  end
@@ -3,8 +3,10 @@
3
3
  module EmailTypo
4
4
  RemoveInvalidChars = lambda do |email|
5
5
  email
6
- .gsub(/(\s|\#|\'|\"|\\)*/, "")
7
- .gsub(/(\,|\.\.)/, ".")
6
+ .gsub(/(\s|[#`'"\\|])*/, "")
7
+ .gsub(%r{/}, ".")
8
+ .gsub(/(,|\.\.)/, ".")
9
+ .gsub("!", "1")
8
10
  .gsub("@@", "@")
9
11
  end
10
12
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EmailTypo
4
- VERSION = "0.1.1".freeze
4
+ VERSION = "0.2.3"
5
5
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_typo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-09 00:00:00.000000000 Z
11
+ date: 2020-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: email_data
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -66,6 +66,48 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-fnando
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
69
111
  - !ruby/object:Gem::Dependency
70
112
  name: simplecov
71
113
  requirement: !ruby/object:Gem::Requirement
@@ -80,24 +122,33 @@ dependencies:
80
122
  - - ">="
81
123
  - !ruby/object:Gem::Version
82
124
  version: '0'
83
- description: Clean up e-mail strings when the user's made a typo (like 'gmail.cmo').
125
+ description: Suggest fixes to a misspelled email address, like john@gmail.cmo.
84
126
  email:
85
- - fnando.vieira@gmail.com
127
+ - me@fnando.com
86
128
  executables: []
87
129
  extensions: []
88
130
  extra_rdoc_files: []
89
131
  files:
132
+ - ".github/FUNDING.yml"
133
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
134
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
135
+ - ".github/PULL_REQUEST_TEMPLATE.md"
136
+ - ".github/dependabot.yml"
137
+ - ".github/workflows/tests.yml"
90
138
  - ".gitignore"
91
139
  - ".rubocop.yml"
92
140
  - ".travis.yml"
141
+ - CHANGELOG.md
93
142
  - CODE_OF_CONDUCT.md
143
+ - CONTRIBUTING.md
94
144
  - Gemfile
95
- - LICENSE.txt
145
+ - LICENSE.md
96
146
  - README.md
97
147
  - Rakefile
98
148
  - bin/console
99
149
  - bin/setup
100
150
  - email_typo.gemspec
151
+ - fat_fingers_last_commit
101
152
  - lib/email_typo.rb
102
153
  - lib/email_typo/add_missing_m.rb
103
154
  - lib/email_typo/add_missing_period.rb
@@ -106,9 +157,12 @@ files:
106
157
  - lib/email_typo/dot_com.rb
107
158
  - lib/email_typo/dot_net.rb
108
159
  - lib/email_typo/dot_org.rb
160
+ - lib/email_typo/fix_extraneous_letter_dot_com.rb
161
+ - lib/email_typo/fix_extraneous_numbers.rb
109
162
  - lib/email_typo/gmail.rb
110
163
  - lib/email_typo/googlemail.rb
111
164
  - lib/email_typo/hotmail.rb
165
+ - lib/email_typo/icloud.rb
112
166
  - lib/email_typo/known_dot_com.rb
113
167
  - lib/email_typo/period_around_at_sign.rb
114
168
  - lib/email_typo/providers.rb
@@ -120,8 +174,14 @@ files:
120
174
  homepage: https://github.com/fnando/email_typo
121
175
  licenses:
122
176
  - MIT
123
- metadata: {}
124
- post_install_message:
177
+ metadata:
178
+ homepage_uri: https://github.com/fnando/email_typo
179
+ bug_tracker_uri: https://github.com/fnando/email_typo/issues
180
+ source_code_uri: https://github.com/fnando/email_typo/tree/v0.2.3
181
+ changelog_uri: https://github.com/fnando/email_typo/tree/v0.2.3/CHANGELOG.md
182
+ documentation_uri: https://github.com/fnando/email_typo/tree/v0.2.3/README.md
183
+ license_uri: https://github.com/fnando/email_typo/tree/v0.2.3/LICENSE.md
184
+ post_install_message:
125
185
  rdoc_options: []
126
186
  require_paths:
127
187
  - lib
@@ -129,15 +189,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
189
  requirements:
130
190
  - - ">="
131
191
  - !ruby/object:Gem::Version
132
- version: '0'
192
+ version: 2.6.0
133
193
  required_rubygems_version: !ruby/object:Gem::Requirement
134
194
  requirements:
135
195
  - - ">="
136
196
  - !ruby/object:Gem::Version
137
197
  version: '0'
138
198
  requirements: []
139
- rubygems_version: 3.0.1
140
- signing_key:
199
+ rubygems_version: 3.1.4
200
+ signing_key:
141
201
  specification_version: 4
142
- summary: Clean up e-mail strings when the user's made a typo (like 'gmail.cmo').
202
+ summary: Suggest fixes to a misspelled email address, like john@gmail.cmo.
143
203
  test_files: []
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 Nando Vieira
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.