emagen 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/Rakefile +1 -0
- data/emagen.gemspec +25 -0
- data/lib/emagen.rb +24 -0
- data/lib/emagen/version.rb +3 -0
- data/spec/emagen_spec.rb +24 -0
- data/spec/spec_helper.rb +1 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 339b998eac590439f04977791628f72ddf0dff96
|
4
|
+
data.tar.gz: e7b3fcdf15c8f0178aff2440c13b145853a42436
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 45d159e55d43978a272ec28aa051ddfe56ed6a86092c252c36a5d7bd9409103b996c90e1080d16bb2e4487e0f947fd32fb2becd4521873e25bb9195572f3b8be
|
7
|
+
data.tar.gz: e72b6313b6a2290dc139e199a24f8c6965431a4af5bc3ec3f40225202cf17a7539fe2adbba8e023ee95cbc0f6784eef82cbe7b0eca4b02cbc2d3baaed4a36efa
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Louis Sayers
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Emagen
|
2
|
+
|
3
|
+
Create a series of possible email addresses from someone's name and a website's domain.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'emagen'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install emagen
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
require 'emagen'
|
21
|
+
name = "Louis Sayers"
|
22
|
+
domain = "louissayers.com"
|
23
|
+
possible_emails = Emagen.for(name, domain)
|
24
|
+
|
25
|
+
# Returns a list of possible emails such as:
|
26
|
+
# LouisSayers@louissayers.com, LSayers@louissayers.com L.S@louissayers.com
|
27
|
+
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
1. Fork it ( http://github.com/<my-github-username>/emagen/fork )
|
32
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
35
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/emagen.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'emagen/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "emagen"
|
8
|
+
spec.version = Emagen::VERSION
|
9
|
+
spec.authors = ["Louis Sayers"]
|
10
|
+
spec.email = ["lssayers@gmail.com"]
|
11
|
+
spec.summary = %q{Generate possible email addresses given a name and domain.}
|
12
|
+
spec.description = %q{Generate possible email addresses given a name and domain.}
|
13
|
+
spec.homepage = "https://github.com/LouisSayers/Emagen"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency 'rspec'
|
24
|
+
spec.add_development_dependency 'pry-nav'
|
25
|
+
end
|
data/lib/emagen.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require "emagen/version"
|
2
|
+
|
3
|
+
module Emagen
|
4
|
+
def for(name, domain)
|
5
|
+
first_name, last_name = name.split
|
6
|
+
first_initial, last_initial = first_name[0], last_name[0]
|
7
|
+
patterns = %w{
|
8
|
+
fn ln fnln fn.ln filn fi.ln fnli fn.li fili fi.li
|
9
|
+
lnfn ln.fn lnfi ln.fi lifn li.fn lifi li.fi
|
10
|
+
fn-ln fi-ln fn-li fi-li ln-fn ln-fi li-fi
|
11
|
+
fn_ln fi_ln fn_li fi_li ln_fn ln_fi li_fi
|
12
|
+
}
|
13
|
+
|
14
|
+
patterns.map do |pattern|
|
15
|
+
email_username = pattern
|
16
|
+
.gsub('fn', first_name)
|
17
|
+
.gsub('ln', last_name)
|
18
|
+
.gsub('fi', first_initial)
|
19
|
+
.gsub('li', last_initial)
|
20
|
+
"#{email_username}@#{domain}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
module_function :for
|
24
|
+
end
|
data/spec/emagen_spec.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Emagen do
|
4
|
+
let(:domain) { "domain.com" }
|
5
|
+
|
6
|
+
describe '#for' do
|
7
|
+
context "valid arguments" do
|
8
|
+
it "should generate email addresses" do
|
9
|
+
expected_usernames = %w{
|
10
|
+
Jack Black JackBlack Jack.Black JBlack J.Black JackB Jack.B JB J.B
|
11
|
+
BlackJack Black.Jack BlackJ Black.J BJack B.Jack BJ B.J
|
12
|
+
Jack-Black J-Black Jack-B J-B Black-Jack Black-J B-J
|
13
|
+
Jack_Black J_Black Jack_B J_B Black_Jack Black_J B_J
|
14
|
+
}
|
15
|
+
|
16
|
+
emails = Emagen.for("Jack Black", domain)
|
17
|
+
expected_usernames.each do |username|
|
18
|
+
expect(emails).to include("#{username}@#{domain}")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'emagen'
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: emagen
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Louis Sayers
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-nav
|
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
|
+
description: Generate possible email addresses given a name and domain.
|
70
|
+
email:
|
71
|
+
- lssayers@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- emagen.gemspec
|
82
|
+
- lib/emagen.rb
|
83
|
+
- lib/emagen/version.rb
|
84
|
+
- spec/emagen_spec.rb
|
85
|
+
- spec/spec_helper.rb
|
86
|
+
homepage: https://github.com/LouisSayers/Emagen
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.2.2
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Generate possible email addresses given a name and domain.
|
110
|
+
test_files:
|
111
|
+
- spec/emagen_spec.rb
|
112
|
+
- spec/spec_helper.rb
|