myna_bird 0.2.9 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NTM5ZTZlYzNiZGQ1NmY0NTdmMTg4NzZhNDIyZTNmMWM4NDZhNjZlOA==
5
- data.tar.gz: !binary |-
6
- YTlkMmUxODMwNzQxNzM1YzYxOGIzMzU1ODM2ZmMzOWU3NTZkMmM3Mg==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- OWE4OWQyZmI4M2Q5ZmQyODg1NThiNGUzNjJhMjU5NWM5YWZjNmMyZmZmNjAw
10
- OTgwMjk1ZTUwMjc4ZGE2MWEzZDgzYmNmYmViYTY5ODJlMWI3ZDFjYWYwM2E0
11
- NTBmMDg2ZTc2ZjQzZTc1MDRmNjBlZmVhM2NkY2NjMTk5M2NjMGY=
12
- data.tar.gz: !binary |-
13
- Nzc4ZGU4YmU5ZTAyYjY3NjI0ODljNTRhYmU2NGE3NjRiNDIwZWI1M2Y1Yjg0
14
- YzhlZTAyMGVkOTg5YzNkMjE5ZWVkMjRjMWUzNTA4OTQ0OTFmNjAzMDE1YTc2
15
- OTg5NDc1NWM1MzE1ODlmODNkYzg2OWE3NWM5YTBiOWFmZTE5YzU=
2
+ SHA1:
3
+ metadata.gz: 780cff4b58660435810a6ce1179f7de16dc0dd48
4
+ data.tar.gz: 9fa8ec0c93eeb9c4b26dcee8caad53832b3a7bbe
5
+ SHA512:
6
+ metadata.gz: 9bf7d7006c2d4f61c3453b4540f85eb77ccb83b5bd030a22c8a0d6b7b39d9cbb7ea958ebbf5e53613a22d5784659d6d98290890621df3f32366dec33d6a329e7
7
+ data.tar.gz: 05a179c7c807bc05c393a5932941d8ca6d84583901316eb57e805a1e0ca4d9e10dfa243bbee6d496794538b48d6ab1d441cc0b7417df94c025c1bb4ff3037ee8
@@ -0,0 +1 @@
1
+ mynabird
@@ -0,0 +1 @@
1
+ 2.1.6
data/Gemfile CHANGED
@@ -1,5 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "jeweler"
4
- gem "rspec"
5
-
3
+ group :development do
4
+ gem "jeweler"
5
+ gem "rspec"
6
+ end
@@ -1,48 +1,50 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- addressable (2.3.5)
4
+ addressable (2.4.0)
5
5
  builder (3.2.2)
6
+ descendants_tracker (0.0.4)
7
+ thread_safe (~> 0.3, >= 0.3.1)
6
8
  diff-lcs (1.1.3)
7
- faraday (0.8.7)
8
- multipart-post (~> 1.1)
9
- git (1.2.5)
10
- github_api (0.10.1)
11
- addressable
12
- faraday (~> 0.8.1)
13
- hashie (>= 1.2)
14
- multi_json (~> 1.4)
15
- nokogiri (~> 1.5.2)
9
+ faraday (0.9.2)
10
+ multipart-post (>= 1.2, < 3)
11
+ git (1.3.0)
12
+ github_api (0.13.1)
13
+ addressable (~> 2.4.0)
14
+ descendants_tracker (~> 0.0.4)
15
+ faraday (~> 0.8, < 0.10)
16
+ hashie (>= 3.4)
17
+ multi_json (>= 1.7.5, < 2.0)
16
18
  oauth2
17
- hashie (2.0.5)
18
- highline (1.6.19)
19
- httpauth (0.2.0)
20
- jeweler (1.8.6)
19
+ hashie (3.4.3)
20
+ highline (1.7.8)
21
+ jeweler (2.1.1)
21
22
  builder
22
- bundler (~> 1.0)
23
+ bundler (>= 1.0)
23
24
  git (>= 1.2.5)
24
- github_api (= 0.10.1)
25
+ github_api
25
26
  highline (>= 1.6.15)
26
- nokogiri (= 1.5.10)
27
+ nokogiri (>= 1.5.10)
27
28
  rake
28
29
  rdoc
29
- json (1.8.0)
30
- jwt (0.1.8)
31
- multi_json (>= 1.5)
32
- multi_json (1.7.7)
33
- multi_xml (0.5.4)
34
- multipart-post (1.2.0)
35
- nokogiri (1.5.10)
36
- oauth2 (0.9.2)
37
- faraday (~> 0.8)
38
- httpauth (~> 0.2)
39
- jwt (~> 0.1.4)
40
- multi_json (~> 1.0)
30
+ semver
31
+ json (1.8.3)
32
+ jwt (1.5.1)
33
+ mini_portile2 (2.0.0)
34
+ multi_json (1.11.3)
35
+ multi_xml (0.5.5)
36
+ multipart-post (2.0.0)
37
+ nokogiri (1.6.7.2)
38
+ mini_portile2 (~> 2.0.0.rc2)
39
+ oauth2 (1.1.0)
40
+ faraday (>= 0.8, < 0.10)
41
+ jwt (~> 1.0, < 1.5.2)
42
+ multi_json (~> 1.3)
41
43
  multi_xml (~> 0.5)
42
- rack (~> 1.2)
43
- rack (1.5.2)
44
- rake (10.1.0)
45
- rdoc (4.0.1)
44
+ rack (>= 1.2, < 3)
45
+ rack (1.6.4)
46
+ rake (11.1.2)
47
+ rdoc (4.2.2)
46
48
  json (~> 1.4)
47
49
  rspec (2.11.0)
48
50
  rspec-core (~> 2.11.0)
@@ -52,6 +54,8 @@ GEM
52
54
  rspec-expectations (2.11.3)
53
55
  diff-lcs (~> 1.1.3)
54
56
  rspec-mocks (2.11.3)
57
+ semver (1.0.1)
58
+ thread_safe (0.3.5)
55
59
 
56
60
  PLATFORMS
57
61
  ruby
@@ -1,19 +1,22 @@
1
- ____ __
2
- /'\_/`\ /\ _`\ __ /\ \
3
- /\ \ __ __ ___ __ \ \ \L\ \ /\_\ _ __ \_\ \
4
- \ \ \__\ \ /\ \/\ \ /' _ `\ /'__`\ \ \ _ <'\/\ \ /\`'__\/'_` \
5
- \ \ \_/\ \\ \ \_\ \ /\ \/\ \ /\ \L\.\_\ \ \L\ \\ \ \\ \ \//\ \L\ \
1
+ ```
2
+ ____ __
3
+ /'\_/`\ /\ _`\ __ /\ \
4
+ /\ \ __ __ ___ __ \ \ \L\ \ /\_\ _ __ \_\ \
5
+ \ \ \__\ \ /\ \/\ \ /' _ `\ /'__`\ \ \ _ <'\/\ \ /\`'__\/'_` \
6
+ \ \ \_/\ \\ \ \_\ \ /\ \/\ \ /\ \L\.\_\ \ \L\ \\ \ \\ \ \//\ \L\ \
6
7
  \ \_\\ \_\\/`____ \\ \_\ \_\\ \__/.\_\\ \____/ \ \_\\ \_\\ \___,_\
7
8
  \/_/ \/_/ `/___/> \\/_/\/_/ \/__/\/_/ \/___/ \/_/ \/_/ \/__,_ /
8
- /\___/
9
- \/__/
9
+ ```/\_
10
+ __/
11
+ \/__/
12
+ ```
10
13
 
11
14
  MynaBird converts email addresses into "account names" suitable for use in a
12
15
  host name.
13
16
 
14
17
  We use this here at Wistia. A user can sign up for an account using just
15
- their email address, and in typical trendy SaaS fashion, they get an account
16
- URL in the form of http://account-name.wistia.com. MynaBird performs the
18
+ their email address, and in typical trendy SaaS fashion, they get an account
19
+ URL in the form of http://account-name.wistia.com. MynaBird performs the
17
20
  conversion of their email into their new account name.
18
21
 
19
22
  It works like this: if the domain is a that of a known ISP or email provider
@@ -26,7 +29,7 @@ For example:
26
29
  brendan.schwartz@gmail.com -> brendan-schwartz
27
30
  brendan+nospam@gmail.com -> brendan
28
31
  support@gmail.com -> support-at-gmail
29
-
32
+
30
33
  Ok, that last one is a bit of a special case, but you get the idea.
31
34
 
32
35
 
@@ -34,19 +37,19 @@ Usage:
34
37
 
35
38
  require 'myna_bird'
36
39
  MynaBird.convert('brendan@wistia.com') #=> 'wistia'
37
-
38
-
40
+
41
+
39
42
  Specs:
40
43
 
41
44
  Just run "rake spec" to run the specs.
42
45
  Don't be shy, feel free to add more examples.
43
-
44
-
46
+
47
+
45
48
  Questions:
46
49
 
47
50
  Feel free to email me at brendan@wistia.com with any questions.
48
-
49
-
51
+
52
+
50
53
  License:
51
54
 
52
- Go nuts. See LICENSE for full details.
55
+ Go nuts. See LICENSE for full details.
data/Rakefile CHANGED
@@ -10,7 +10,6 @@ begin
10
10
  gem.email = "brendan@wistia.com"
11
11
  gem.homepage = "http://github.com/wistia/myna_bird"
12
12
  gem.authors = ["Brendan Schwartz"]
13
- gem.add_development_dependency "rspec", ">= 1.2.9"
14
13
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
14
  end
16
15
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.9
1
+ 0.2.11
@@ -1,39 +1,39 @@
1
1
  class MynaBird
2
-
2
+
3
3
  class MalformedEmailException < Exception
4
4
  end
5
-
5
+
6
6
  COMMON_LOCALS = %w(
7
7
  support info sales marketing admin webmaster help
8
8
  )
9
-
9
+
10
10
  COMMON_DOMAINS = %w(
11
- hotmail msn live yahoo yahoo.co.uk ymail rocketmail gmail googlemail aol
12
- fastmail.fm web inbox freemail rediff indiatimes lycos libero.it rambler.ru mac
13
- paracalls linkedin mynet interia.pl yandex.ru sina 126 lycos bol in me
11
+ hotmail msn live yahoo yahoo.co.uk ymail rocketmail gmail googlemail aol
12
+ fastmail.fm web inbox freemail rediff indiatimes lycos libero.it rambler.ru mac
13
+ paracalls linkedin mynet interia.pl yandex sina 126 lycos bol in me
14
14
  voila.fr mail comcast netcom roadrunner verizon 1and1 att adelphia
15
15
  bigpond bluebottle blueyonder btopenworld charter cox earthlink sbc telus
16
16
  mailinator charter rogers sympatico tiscali tmail sbcglobal aim windowslive
17
17
  juno qq optonline.net mailhaven.com shaw.ca btinternet email orange.fr
18
- frontier.com outlook.com
18
+ frontier.com outlook icloud reliable-mail
19
19
  ) + [
20
20
  /\.edu$/
21
21
  ]
22
-
22
+
23
23
  def self.convert(email)
24
24
  new(email).name
25
25
  end
26
-
26
+
27
27
  def initialize(email)
28
28
  # email must be in a somewhat sane format
29
29
  # i.e. have an @ sign and at least one letter or number on each side of it
30
30
  raise MalformedEmailException unless email =~ /^[^@]*[a-z0-9][^@]*@[^@]*[a-z0-9][^@]*$/i
31
-
31
+
32
32
  @email = email.downcase
33
33
  @local, @domain = @email.split('@')
34
34
  end
35
-
36
-
35
+
36
+
37
37
  # extract the name
38
38
  def name
39
39
  if common_local? && common_domain?
@@ -44,19 +44,19 @@ class MynaBird
44
44
  local_name
45
45
  else
46
46
  domain_name
47
- end
47
+ end
48
48
  end
49
-
49
+
50
50
  def domain_name
51
51
  just_the_host = @domain.split('.').first
52
52
  self.class.nameize(just_the_host)
53
53
  end
54
-
54
+
55
55
  def local_name
56
56
  local_sans_alias = @local.gsub(/\+.*$/, '')
57
57
  self.class.nameize(local_sans_alias)
58
58
  end
59
-
59
+
60
60
  def self.nameize(str)
61
61
  name = str.downcase
62
62
  name.gsub!(/[^a-z0-9]+/, '-')
@@ -64,7 +64,7 @@ class MynaBird
64
64
  name.gsub!(/^\-/,'')
65
65
  name
66
66
  end
67
-
67
+
68
68
  def common_domain?
69
69
  COMMON_DOMAINS.each do |domain|
70
70
  if domain.is_a?(Regexp)
@@ -75,7 +75,7 @@ class MynaBird
75
75
  return true if /^#{domain}\./.match(@domain)
76
76
  end
77
77
  end
78
-
78
+
79
79
  return false
80
80
  end
81
81
 
@@ -87,8 +87,8 @@ class MynaBird
87
87
  return true if local == @local
88
88
  end
89
89
  end
90
-
90
+
91
91
  return false
92
92
  end
93
-
93
+
94
94
  end
@@ -2,26 +2,29 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: myna_bird 0.2.11 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "myna_bird"
8
- s.version = "0.2.9"
9
+ s.version = "0.2.11"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Brendan Schwartz"]
12
- s.date = "2013-07-10"
14
+ s.date = "2016-04-25"
13
15
  s.description = "Given an email address, MynaBird generates a name suitable for use in a host name"
14
16
  s.email = "brendan@wistia.com"
15
17
  s.extra_rdoc_files = [
16
18
  "LICENSE",
17
- "README"
19
+ "README.md"
18
20
  ]
19
21
  s.files = [
20
- ".rvmrc",
22
+ ".ruby-gemset",
23
+ ".ruby-version",
21
24
  "Gemfile",
22
25
  "Gemfile.lock",
23
26
  "LICENSE",
24
- "README",
27
+ "README.md",
25
28
  "Rakefile",
26
29
  "VERSION",
27
30
  "lib/myna_bird.rb",
@@ -31,26 +34,22 @@ Gem::Specification.new do |s|
31
34
  "spec/spec_helper.rb"
32
35
  ]
33
36
  s.homepage = "http://github.com/wistia/myna_bird"
34
- s.require_paths = ["lib"]
35
- s.rubygems_version = "2.0.4"
37
+ s.rubygems_version = "2.4.6"
36
38
  s.summary = "Transform email addresses into account names for your app"
37
39
 
38
40
  if s.respond_to? :specification_version then
39
41
  s.specification_version = 4
40
42
 
41
43
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
- s.add_runtime_dependency(%q<jeweler>, [">= 0"])
43
- s.add_runtime_dependency(%q<rspec>, [">= 0"])
44
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
44
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
45
+ s.add_development_dependency(%q<rspec>, [">= 0"])
45
46
  else
46
47
  s.add_dependency(%q<jeweler>, [">= 0"])
47
48
  s.add_dependency(%q<rspec>, [">= 0"])
48
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
49
49
  end
50
50
  else
51
51
  s.add_dependency(%q<jeweler>, [">= 0"])
52
52
  s.add_dependency(%q<rspec>, [">= 0"])
53
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
54
53
  end
55
54
  end
56
55
 
@@ -2,27 +2,28 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe MynaBird do
4
4
 
5
- it_should_convert 'brendan@wistia.com', :to => 'wistia'
6
- it_should_convert 'brendan.schwartz@gmail.com', :to => 'brendan-schwartz'
7
- it_should_convert 'support@gmail.com', :to => 'support-at-gmail'
8
-
9
- it_should_convert 'brendan....schwartz@gmail.com', :to => 'brendan-schwartz'
10
- it_should_convert 'bts@alumni.brown.edu', :to => 'bts'
11
- it_should_convert 'claire@megacorp.co.uk', :to => 'megacorp'
12
- it_should_convert 'brendan19@aol.com', :to => 'brendan19'
13
- it_should_convert 'brendan.@aol.com', :to => 'brendan'
14
- it_should_convert '.brendan@aol.com', :to => 'brendan'
15
- it_should_convert 'brendan+nospam@aol.com', :to => 'brendan'
16
- it_should_convert 'BRENDAN@aol.com', :to => 'brendan'
17
- it_should_convert 'brendan@WISTIA.COM', :to => 'wistia'
18
- it_should_convert 'BRENDAN@WISTIA', :to => 'wistia'
19
- it_should_convert 'brendan@outlook.com', :to => 'brendan'
20
-
5
+ it_should_convert 'brendan@wistia.com', to: 'wistia'
6
+ it_should_convert 'brendan.schwartz@gmail.com', to: 'brendan-schwartz'
7
+ it_should_convert 'support@gmail.com', to: 'support-at-gmail'
8
+
9
+ it_should_convert 'brendan....schwartz@gmail.com', to: 'brendan-schwartz'
10
+ it_should_convert 'bts@alumni.brown.edu', to: 'bts'
11
+ it_should_convert 'claire@megacorp.co.uk', to: 'megacorp'
12
+ it_should_convert 'brendan19@aol.com', to: 'brendan19'
13
+ it_should_convert 'brendan.@aol.com', to: 'brendan'
14
+ it_should_convert '.brendan@aol.com', to: 'brendan'
15
+ it_should_convert 'brendan+nospam@aol.com', to: 'brendan'
16
+ it_should_convert 'BRENDAN@aol.com', to: 'brendan'
17
+ it_should_convert 'brendan@WISTIA.COM', to: 'wistia'
18
+ it_should_convert 'BRENDAN@WISTIA', to: 'wistia'
19
+ it_should_convert 'brendan@outlook.com', to: 'brendan'
20
+ it_should_convert 'james@outlook.com.br', to: 'james'
21
+
21
22
  # bad input
22
23
  it_should_not_convert 'no.at.sign'
23
24
  it_should_not_convert '@domain.only'
24
25
  it_should_not_convert 'local.only@'
25
26
  it_should_not_convert '@@@@'
26
27
  it_should_not_convert '++@++'
27
-
28
+
28
29
  end
metadata CHANGED
@@ -1,57 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myna_bird
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brendan Schwartz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-10 00:00:00.000000000 Z
11
+ date: 2016-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jeweler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
- type: :runtime
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ! '>='
31
+ - - ">="
39
32
  - !ruby/object:Gem::Version
40
33
  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: 1.2.9
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - ! '>='
38
+ - - ">="
53
39
  - !ruby/object:Gem::Version
54
- version: 1.2.9
40
+ version: '0'
55
41
  description: Given an email address, MynaBird generates a name suitable for use in
56
42
  a host name
57
43
  email: brendan@wistia.com
@@ -59,13 +45,14 @@ executables: []
59
45
  extensions: []
60
46
  extra_rdoc_files:
61
47
  - LICENSE
62
- - README
48
+ - README.md
63
49
  files:
64
- - .rvmrc
50
+ - ".ruby-gemset"
51
+ - ".ruby-version"
65
52
  - Gemfile
66
53
  - Gemfile.lock
67
54
  - LICENSE
68
- - README
55
+ - README.md
69
56
  - Rakefile
70
57
  - VERSION
71
58
  - lib/myna_bird.rb
@@ -82,17 +69,17 @@ require_paths:
82
69
  - lib
83
70
  required_ruby_version: !ruby/object:Gem::Requirement
84
71
  requirements:
85
- - - ! '>='
72
+ - - ">="
86
73
  - !ruby/object:Gem::Version
87
74
  version: '0'
88
75
  required_rubygems_version: !ruby/object:Gem::Requirement
89
76
  requirements:
90
- - - ! '>='
77
+ - - ">="
91
78
  - !ruby/object:Gem::Version
92
79
  version: '0'
93
80
  requirements: []
94
81
  rubyforge_project:
95
- rubygems_version: 2.0.4
82
+ rubygems_version: 2.4.6
96
83
  signing_key:
97
84
  specification_version: 4
98
85
  summary: Transform email addresses into account names for your app
data/.rvmrc DELETED
@@ -1,2 +0,0 @@
1
- rvm use 1.9.3@mynabird --create
2
-