nameable 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +10 -0
- data/Gemfile.lock +30 -0
- data/History.txt +11 -0
- data/LICENSE +0 -0
- data/README.rdoc +0 -0
- data/Rakefile +31 -49
- data/TODO +0 -0
- data/VERSION +1 -0
- data/lib/nameable.rb +2 -2
- data/spec/nameable_spec.rb +4 -4
- data/spec/spec.opts +5 -0
- data/spec/spec_helper.rb +0 -1
- metadata +52 -12
- data/nameable.gemspec +0 -26
- data/script/destroy +0 -14
- data/script/generate +0 -14
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.3)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.8.4)
|
7
|
+
bundler (~> 1.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rdoc
|
11
|
+
json (1.7.4)
|
12
|
+
rake (0.9.2.2)
|
13
|
+
rdoc (3.12)
|
14
|
+
json (~> 1.4)
|
15
|
+
rspec (2.11.0)
|
16
|
+
rspec-core (~> 2.11.0)
|
17
|
+
rspec-expectations (~> 2.11.0)
|
18
|
+
rspec-mocks (~> 2.11.0)
|
19
|
+
rspec-core (2.11.1)
|
20
|
+
rspec-expectations (2.11.2)
|
21
|
+
diff-lcs (~> 1.1.3)
|
22
|
+
rspec-mocks (2.11.1)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
bundler
|
29
|
+
jeweler
|
30
|
+
rspec
|
data/History.txt
ADDED
data/LICENSE
CHANGED
File without changes
|
data/README.rdoc
CHANGED
File without changes
|
data/Rakefile
CHANGED
@@ -1,57 +1,39 @@
|
|
1
|
-
|
2
|
-
require 'rake/gempackagetask'
|
3
|
-
require 'rubygems/specification'
|
4
|
-
require 'date'
|
5
|
-
require 'spec/rake/spectask'
|
6
|
-
|
7
|
-
GEM = "nameable"
|
8
|
-
GEM_VERSION = "0.5.0"
|
9
|
-
AUTHOR = "Chris Horn"
|
10
|
-
EMAIL = "chorn@chorn.com"
|
11
|
-
HOMEPAGE = "http://github.com/chorn/nameable"
|
12
|
-
SUMMARY = "A ruby library to parse people names into parts and reformat them."
|
13
|
-
|
14
|
-
spec = Gem::Specification.new do |s|
|
15
|
-
s.name = GEM
|
16
|
-
s.version = GEM_VERSION
|
17
|
-
s.platform = Gem::Platform::RUBY
|
18
|
-
s.has_rdoc = true
|
19
|
-
s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
|
20
|
-
s.summary = SUMMARY
|
21
|
-
s.description = s.summary
|
22
|
-
s.author = AUTHOR
|
23
|
-
s.email = EMAIL
|
24
|
-
s.homepage = HOMEPAGE
|
1
|
+
# encoding: utf-8
|
25
2
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
32
11
|
end
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
gem.name = "nameable"
|
17
|
+
gem.homepage = "https://github.com/chorn/nameable"
|
18
|
+
gem.license = "MIT"
|
19
|
+
gem.summary = %Q{Provides parsing and output of person names.}
|
20
|
+
gem.description = %Q{A gem that provides parsing and output of person names.}
|
21
|
+
gem.email = "chorn@chorn.com"
|
22
|
+
gem.authors = ["Chris Horn"]
|
23
|
+
gem.files = FileList['lib/**/*.rb', 'Gemfile*', '[A-Z]*', 'Rakefile', 'spec/*', 'examples/*'].to_a
|
40
24
|
end
|
25
|
+
Jeweler::RubygemsDotOrgTasks.new
|
41
26
|
|
42
|
-
|
43
|
-
|
44
|
-
|
27
|
+
require 'rspec/core'
|
28
|
+
require 'rspec/core/rake_task'
|
29
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
30
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
45
31
|
end
|
46
32
|
|
47
|
-
|
48
|
-
|
49
|
-
|
33
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
34
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
35
|
+
spec.rcov = true
|
50
36
|
end
|
51
37
|
|
52
|
-
|
53
|
-
|
54
|
-
File.open("#{GEM}.gemspec", "w") do |file|
|
55
|
-
file.puts spec.to_ruby
|
56
|
-
end
|
57
|
-
end
|
38
|
+
task :default => :spec
|
39
|
+
|
data/TODO
CHANGED
File without changes
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.5.1
|
data/lib/nameable.rb
CHANGED
@@ -32,10 +32,10 @@ module Nameable
|
|
32
32
|
"Ph.D." => /^\(*(phd\.?)\)*$/i
|
33
33
|
}
|
34
34
|
|
35
|
-
SUFFIX_GENERATIONAL_ROMAN = /^\(*[IVX
|
35
|
+
SUFFIX_GENERATIONAL_ROMAN = /^\(*[IVX.]+\)*$/i
|
36
36
|
SUFFIX_ACADEMIC = /^(APR|RPh|MD|MA|DMD|DDS|PharmD|EngD|DPhil|JD|DD|DO|BA|BS|BSc|BE|BFA|MA|MS|MSc|MFA|MLA|MBA)$/i
|
37
37
|
SUFFIX_PROFESSIONAL = /^(PE|CSA|CPA|CPL|CME|CEng|OFM|CSV|Douchebag)$/i
|
38
|
-
SUFFIX_ABBREVIATION = /^[A-Z
|
38
|
+
SUFFIX_ABBREVIATION = /^[A-Z.]+[A-Z.]+$/ # It should be at least 2 letters
|
39
39
|
|
40
40
|
LAST_NAME_PRE_DANGLERS = /^(mc|vere|von|van|da|de|del|della|di|da|pietro|vanden|du|st|la|ter|ten)$/i
|
41
41
|
O_LAST_NAME_PRE_CONCATS = /^(o'|o`)$/i
|
data/spec/nameable_spec.rb
CHANGED
@@ -3,19 +3,19 @@ require File.dirname(__FILE__) + '/spec_helper'
|
|
3
3
|
describe Nameable::Latin do
|
4
4
|
describe "with 'Mr. Chris Horn PhD" do
|
5
5
|
subject { Nameable::Latin.new.parse("Mr. Chris Horn PhD") }
|
6
|
-
|
6
|
+
|
7
7
|
it("should extract prefix") { subject.prefix.should == "Mr." }
|
8
8
|
it("should extract first name") { subject.first.should == "Chris" }
|
9
9
|
it("should extract last name") { subject.last.should == "Horn" }
|
10
10
|
it("should extract and normalize suffix") { subject.suffix.should == "Ph.D." }
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
describe "with 'Chris Old Biscuit Barrel Horn'" do
|
14
14
|
subject { Nameable::Latin.new.parse("Chris Old Biscuit Barrel Horn") }
|
15
|
-
|
15
|
+
|
16
16
|
it("should extract first name") { subject.first.should == "Chris" }
|
17
17
|
it("should extract middle name") { subject.middle.should == "Old Biscuit Barrel" }
|
18
18
|
it("should extract last name") { subject.last.should == "Horn" }
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nameable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,28 +9,66 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
13
|
-
dependencies:
|
12
|
+
date: 2012-08-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: jeweler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
14
46
|
description: A gem that provides parsing and output of person names.
|
15
47
|
email: chorn@chorn.com
|
16
48
|
executables: []
|
17
49
|
extensions: []
|
18
|
-
extra_rdoc_files:
|
50
|
+
extra_rdoc_files:
|
51
|
+
- LICENSE
|
52
|
+
- README.rdoc
|
53
|
+
- TODO
|
19
54
|
files:
|
55
|
+
- Gemfile
|
56
|
+
- Gemfile.lock
|
57
|
+
- History.txt
|
20
58
|
- LICENSE
|
21
59
|
- README.rdoc
|
22
60
|
- Rakefile
|
23
61
|
- TODO
|
24
|
-
-
|
62
|
+
- VERSION
|
63
|
+
- examples/nameable_web_service.rb
|
64
|
+
- examples/test.rb
|
25
65
|
- lib/nameable.rb
|
26
|
-
- script/destroy
|
27
|
-
- script/generate
|
28
66
|
- spec/nameable_spec.rb
|
67
|
+
- spec/spec.opts
|
29
68
|
- spec/spec_helper.rb
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
licenses: []
|
69
|
+
homepage: https://github.com/chorn/nameable
|
70
|
+
licenses:
|
71
|
+
- MIT
|
34
72
|
post_install_message:
|
35
73
|
rdoc_options: []
|
36
74
|
require_paths:
|
@@ -41,6 +79,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
41
79
|
- - ! '>='
|
42
80
|
- !ruby/object:Gem::Version
|
43
81
|
version: '0'
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
hash: -172521366074820921
|
44
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
86
|
none: false
|
46
87
|
requirements:
|
@@ -54,4 +95,3 @@ signing_key:
|
|
54
95
|
specification_version: 3
|
55
96
|
summary: Provides parsing and output of person names.
|
56
97
|
test_files: []
|
57
|
-
has_rdoc: true
|
data/nameable.gemspec
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = "nameable"
|
3
|
-
s.version = "0.5.0"
|
4
|
-
s.date = "2012-06-06"
|
5
|
-
s.summary = "Provides parsing and output of person names."
|
6
|
-
s.email = "chorn@chorn.com"
|
7
|
-
s.homepage = "http://github.com/chorn/nameable"
|
8
|
-
s.description = "A gem that provides parsing and output of person names."
|
9
|
-
s.has_rdoc = true
|
10
|
-
s.authors = ["Chris Horn"]
|
11
|
-
s.files = [ "LICENSE",
|
12
|
-
"README.rdoc",
|
13
|
-
"Rakefile",
|
14
|
-
"TODO",
|
15
|
-
"nameable.gemspec",
|
16
|
-
"lib/nameable.rb",
|
17
|
-
"script/destroy",
|
18
|
-
"script/generate",
|
19
|
-
"spec/nameable_spec.rb",
|
20
|
-
"spec/spec_helper.rb",
|
21
|
-
"examples/test.rb",
|
22
|
-
"examples/nameable_web_service.rb"
|
23
|
-
]
|
24
|
-
s.test_files = []
|
25
|
-
s.rdoc_options = []
|
26
|
-
end
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:newgem_simple, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:newgem_simple, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|