-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Seperate module and CLI logic - Parse CLI options using 'optparse' - Use 'tate' 1.6.0 or above
- Loading branch information
Showing
14 changed files
with
254 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ruby-2.3.0 | ||
ruby-2.7.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
language: ruby | ||
rvm: | ||
- 2.2.3 | ||
- 2.3.0 | ||
before_install: gem install bundler -v 1.11.2 | ||
- 2.7.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
# Guessmail | ||
# Guessmail 💌 | ||
|
||
[![Travis](https://img.shields.io/travis/krmbzds/guessmail.svg)](https://travis-ci.org/krmbzds/guessmail) | ||
[![Gem](https://img.shields.io/gem/dt/guessmail.svg)](https://rubygems.org/gems/guessmail) | ||
[![Gem](https://img.shields.io/gem/v/guessmail.svg)](https://rubygems.org/gems/guessmail) | ||
|
||
**guessmail** helps you find possible email addresses of a person. | ||
[**guessmail**][Guessmail] helps you find possible email addresses of a person. | ||
|
||
## Usage | ||
|
||
``` | ||
Usage: guessmail first [middle] last domain | ||
Examples | ||
guessmail Yukihiro Matz Matsumoto ruby-lang.org | ||
guessmail Satoshi Nakamoto gmx.de | ||
Usage: guessmail [-e] [-l LANGUAGE] first [middle] last domain | ||
-e, --extended Include less common email combinations | ||
-l, --language LANGUAGE Set language | ||
-h, --help Shows help message | ||
-v, --version Shows version | ||
``` | ||
|
||
## Examples | ||
|
@@ -33,7 +33,7 @@ [email protected] | |
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] <-- This is his email address by the way | ||
[email protected] <-- This is the actual email address | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
|
@@ -47,7 +47,15 @@ [email protected] | |
[email protected] | ||
``` | ||
|
||
You can then use an email verifier service or use other methods to find out which one of these email addresses belong to the person you are searching for. Let's not get into that here. | ||
You can then use an email verifier service or use other methods to find out which one of these email addresses belong to the person you are searching for. | ||
|
||
[guessmail][Guessmail] can transliterate non-ASCII input since it uses [tate][tate] under the hood. Try it out! | ||
|
||
```sh | ||
guessmail Игорь Богданов lex.bg -el bg | ||
guessmail Günter Außem gmx.de --language de | ||
guessmail Yukihiro Matz Matsumoto ruby-lang.org | ||
``` | ||
|
||
## Is it any good? | ||
|
||
|
@@ -73,15 +81,34 @@ Or install it yourself as: | |
$ gem install guessmail | ||
``` | ||
|
||
## Development | ||
|
||
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. | ||
|
||
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][RubyGems]. | ||
|
||
## Contributing | ||
|
||
1. Fork it (https://github.com/krmbzds/guessmail/fork) | ||
1. [Fork the repository][Fork] | ||
2. Create your feature branch (`git checkout -b my-new-feature`) | ||
3. Commit your changes (`git commit -am 'Add some feature'`) | ||
4. Push to the branch (`git push origin my-new-feature`) | ||
5. Create a new Pull Request | ||
|
||
### Donations ❤️ | ||
|
||
You can donate me at [Liberapay][Donation]. Thanks! ☕️ | ||
|
||
## License | ||
|
||
The MIT License (MIT) | ||
Copyright (c) 2016 Kerem Bozdas | ||
Copyright © 2016-2020 [Kerem Bozdas][Personal Webpage] | ||
|
||
This project is available under the terms of the [MIT License][License]. | ||
|
||
[Donation]: https://liberapay.com/krmbzds/donate | ||
[Fork]: https://github.com/krmbzds/guessmail/fork | ||
[Guessmail]: https://github.com/krmbzds/guessmail | ||
[License]: http://kerem.mit-license.org | ||
[Personal Webpage]: http://kerembozdas.com | ||
[RubyGems]: https://rubygems.org | ||
[Tate]: https://github.com/krmbzds/tate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
require "bundler/gem_tasks" | ||
require "rspec/core/rake_task" | ||
# frozen_string_literal: true | ||
|
||
require 'bundler/gem_tasks' | ||
require 'rspec/core/rake_task' | ||
|
||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
task :default => :spec | ||
task default: :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,41 @@ | ||
#!/usr/bin/env ruby | ||
# encoding: UTF-8 | ||
# frozen_string_literal: true | ||
|
||
lib = File.expand_path(File.dirname(__FILE__) + '/../lib') | ||
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib) | ||
|
||
require 'tate' | ||
require 'templates' | ||
require 'guessmail' | ||
require 'optparse' | ||
|
||
@help = ' | ||
Usage: guessmail first [middle] last domain | ||
options = {} | ||
|
||
Examples | ||
guessmail Yukihiro Matz Matsumoto ruby-lang.org | ||
guessmail Satoshi Nakamoto gmx.de | ||
' | ||
option_parser = OptionParser.new do |opts| | ||
opts.banner = 'Usage: guessmail [-e] [-l LANGUAGE] first [middle] last domain' | ||
opts.on('-e', '--extended', 'Include less common email combinations') do | ||
options[:extended] = true | ||
end | ||
opts.on('-l LANGUAGE', '--language LANGUAGE', String, 'Set language') do |language| | ||
options[:language] = language | ||
end | ||
opts.on('-h', '--help', 'Shows help message') do | ||
options[:help] = opts.help | ||
end | ||
opts.on('-v', '--version', 'Shows version') do | ||
options[:version] = Guessmail::VERSION | ||
end | ||
end | ||
|
||
def main | ||
args = ARGV.map { |x| Tate.transliterate(x.downcase) } # tate'd | ||
option_parser.parse! | ||
|
||
case args.length | ||
when 3 | ||
fn, ln = args.values_at(0, 1) | ||
fi, li = fn[0], ln[0] | ||
dn = args[2] | ||
STDOUT.write $FL % {fn: fn, ln: ln, fi: fi, li: li, dn: dn} | ||
when 4 | ||
fn, mn, ln = args.values_at(0, 1, 2) | ||
fi, mi, li = fn[0], mn[0], ln[0] | ||
dn = args[3] | ||
STDOUT.write $FML % {fn: fn, mn: mn, ln: ln, fi: fi, mi: mi, li: li, dn: dn} | ||
result = | ||
if options[:help] | ||
options[:help] | ||
elsif options[:version] | ||
options[:version] | ||
elsif [3, 4].include? ARGV.size | ||
Guessmail.guess(ARGV, options) | ||
else | ||
STDOUT.write @help | ||
option_parser.help | ||
end | ||
end | ||
|
||
main | ||
STDOUT.write result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
# coding: utf-8 | ||
lib = File.expand_path('../lib', __FILE__) | ||
# frozen_string_literal: true | ||
|
||
lib = File.expand_path('lib', __dir__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
require 'guessmail/version' | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = "guessmail" | ||
spec.name = 'guessmail' | ||
spec.version = Guessmail::VERSION | ||
spec.authors = ["Kerem Bozdas"] | ||
spec.email = ["[email protected]"] | ||
spec.authors = ['Kerem Bozdas'] | ||
spec.email = ['[email protected]'] | ||
|
||
spec.summary = "Find anyone's email address" | ||
spec.description = "Find anyone's email address" | ||
spec.homepage = "https://github.com/krmbzds/guessmail" | ||
spec.homepage = 'https://github.com/krmbzds/guessmail' | ||
|
||
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } | ||
spec.bindir = "bin" | ||
spec.executables = ["guessmail"] | ||
spec.require_paths = ["lib"] | ||
spec.bindir = 'bin' | ||
spec.executables = ['guessmail'] | ||
spec.require_paths = ['lib'] | ||
|
||
spec.add_runtime_dependency "tate", "~> 0.1.4" | ||
spec.add_development_dependency "bundler", "~> 1.11" | ||
spec.add_development_dependency "rake", "~> 10.0" | ||
spec.add_development_dependency "rspec", "~> 3.0" | ||
spec.add_runtime_dependency 'tate', '~> 1.6.0' | ||
spec.add_development_dependency 'bundler' | ||
spec.add_development_dependency 'rake' | ||
spec.add_development_dependency 'rspec' | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,25 @@ | ||
require "guessmail/version" | ||
# frozen_string_literal: true | ||
|
||
lib = File.expand_path(File.dirname(__FILE__) + '/../lib') | ||
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib) | ||
|
||
require 'guessmail/version' | ||
require 'tate' | ||
require 'templates' | ||
|
||
module Guessmail | ||
# I do nothing | ||
def self.guess(names, options) | ||
names.map!(&:downcase) | ||
|
||
dn = names.pop | ||
fn = names.shift | ||
ln = names.pop | ||
mn = names.pop | ||
|
||
params = { fn: fn, mn: mn, ln: ln, fi: fn[0], mi: (mn[0] if mn), li: ln[0], dn: dn } | ||
template = options[:extended] ? (mn ? FMLE : FLE) : (mn ? FL : FML) | ||
string = format(template, params) | ||
|
||
Tate.transliterate(string, options[:language]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Guessmail | ||
VERSION = "0.1.2" | ||
VERSION = '0.1.2' | ||
end |
Oops, something went wrong.