Skip to content

Commit

Permalink
Merge pull request #4 from chorn/gem_signing
Browse files Browse the repository at this point in the history
Add gem signing and checksums
  • Loading branch information
chorn committed Jun 25, 2015
2 parents e2343a8 + 0b5b706 commit 917c134
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 27 deletions.
38 changes: 19 additions & 19 deletions Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
nameable (1.1.0)
nameable (1.1.1)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -61,19 +61,19 @@ GEM
rb-fsevent (0.9.5)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rspec (3.2.0)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-core (3.2.3)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.1)
rspec (3.3.0)
rspec-core (~> 3.3.0)
rspec-expectations (~> 3.3.0)
rspec-mocks (~> 3.3.0)
rspec-core (3.3.1)
rspec-support (~> 3.3.0)
rspec-expectations (3.3.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.1)
rspec-support (~> 3.3.0)
rspec-mocks (3.3.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
rspec-support (~> 3.3.0)
rspec-support (3.3.0)
shellany (0.0.1)
simplecov (0.10.0)
docile (~> 1.1.0)
Expand All @@ -92,11 +92,11 @@ PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.6, >= 1.6.2)
codeclimate-test-reporter (~> 0.4.7)
guard (~> 2.12.6)
guard-bundler (~> 2.1.0)
guard-rspec (~> 4.5.2)
bundler (~> 1.6)
codeclimate-test-reporter (~> 0.4)
guard (~> 2.12)
guard-bundler (~> 2.1)
guard-rspec (~> 4.5)
nameable!
rake (~> 10.4.2)
rspec (~> 3.2.0)
rake (~> 10.4)
rspec (~> 3.3)
15 changes: 13 additions & 2 deletions README.md
Expand Up @@ -29,15 +29,15 @@ puts Nameable('chris horn, iii')
puts Nameable.parse('chris horn, iii')
#=> #<Nameable::Latin:0x007f8470e01b08 @first="Chris", @last="Horn", @middle=nil, @prefix=nil, @suffix="III.">
```
Using a database of first names from the U.S. Social Security Administration, Nameable will make a guess at the gender of a name.
Using a database of first names from the U.S. Social Security Administration, Nameable will pick the most likely gender for a name.

```ruby
Nameable::Latin.new('Chris').gender
#=> :male
Nameable::Latin.new('Janine').female?
#=> true
```
Using a database of last names from the U.S. Census, Nameable will return the ethnicity breakdown as a Hash.
Using a database of last names from the U.S. Census, Nameable will return the ethnicity breakdown as a Hash.
```ruby
Nameable::Latin.new('Chris', 'Horn').ethnicity
#=> {:rank=>593, :count=>51380, :percent_white=>86.75, :percent_black=>8.31, :percent_asian_pacific_islander=>0.84, :percent_american_indian_alaska_native=>1.16, :percent_two_or_more_races=>1.46, :percent_hispanic=>1.48}
Expand All @@ -51,6 +51,15 @@ I've included a little web service, which should be installed as "nameable_web_s

By inspiration, I should really say "other projects from which I yanked their code, ideas, examples and data." At worst I'll make sure the other projects I looked at and borrowed from are credited here.

# Security

As of version `1.1.1`., the nameable gem is cryptographically signed. To be sure the gem you install hasn’t been tampered with, add my public key as a trusted certificate, and verify that nameable and any dependencies it has are also signed:

```
gem cert --add <(curl -Ls https://raw.github.com/chorn/nameable/master/certs/chorn.pem)
gem install nameable -P HighSecurity
```

# References

* [Open Refine](http://openrefine.org/) formerly [Google Refine](https://code.google.com/p/google-refine/)
Expand All @@ -66,6 +75,8 @@ Thus far I've gone long stretches where this project did exactly what I needed i

The first time an instance of Nameable uses the gender method, the database of first names shipped with the gem will be parsed. The same is true for the last name data which is quite a bit larger. They aren't huge, and it only happens the first time, which is why I opted to leave the data in the gem, and not split it up into a different thing. If you hate that more than you hate gems that require extra steps to be useable let me know.

I don't like that the Ethnicity data is just a Hash.

Oh, and github, pull request, workflow, yada yada.

-chorn
13 changes: 12 additions & 1 deletion Rakefile
@@ -1,2 +1,13 @@
require "bundler/gem_tasks"
require 'bundler/gem_tasks'
require 'digest/sha2'

task default: %w[build]

desc "Update checksums for gems in ./pkg"
task :checksums do
Dir.glob('pkg/*.gem').each do |gem|
checksum = Digest::SHA512.new.hexdigest(File.read(gem))
File.open("#{gem.gsub(/pkg/, 'checksums')}.sha512", 'w' ) {|f| f.write(checksum) }
end
end

55 changes: 55 additions & 0 deletions certs/chorn.pem
@@ -0,0 +1,55 @@
-----BEGIN CERTIFICATE-----
MIIJvjCCBaagAwIBAgIJAM/4MvGHp6qBMA0GCSqGSIb3DQEBDQUAMDoxHjAcBgkq
hkiG9w0BCQEWD2Nob3JuQGNob3JuLmNvbTEYMBYGA1UEAwwPY2hvcm5AY2hvcm4u
Y29tMB4XDTE1MDYxOTExMzIyNVoXDTIwMDYxNzExMzIyNVowOjEeMBwGCSqGSIb3
DQEJARYPY2hvcm5AY2hvcm4uY29tMRgwFgYDVQQDDA9jaG9ybkBjaG9ybi5jb20w
ggQiMA0GCSqGSIb3DQEBAQUAA4IEDwAwggQKAoIEAQCrmvCKjihyb0/wGp6xds1M
PII8KrtYztDRFD5kmJioqBt/8VcjrLqgCPKzafCY/ztLoRq7Zegjeer/QS7mUJGL
EIG8hMSsA80y1+jCa0TmIbpRic9Y5RQoA0SiKGBqZ1j0rbhP5ZbQXxE6IG9aSxRU
WTeSiGfcxWOG+as0L1qBrpuS9wXGenwsudLNouCY0ekRhOyQr3g+9U/dJqkb5ucg
Mj9OyYQFPLnbml4SoTVy7KcbuuzEyPcaf+Zc688if5Bc3yQddnQfmbINhuQuqk/f
EXOFarN1jZLN04mqjOYa9vR0W+AxEtrYLaTD1+ILoJzFhlO5NCTBMxSVNxlt95sY
opEabhgZolrUA653mnAvNq7HEnbdH4iSUEHtSD1e0goGhaRmh7NmJPR3jQgj4dox
L+FlE2MF4SW0lP74438BO29ClenGnPNgYWFuV0rSjmyTIMKkFHYP43VsNGVUv3zh
JH6uqkXQvjEPWYqC42noEmpga1xxRKUizj90gzFtBXtOYi2AX2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ihLRMIdAjtL
nnnm3d3shuIrTfRG4YwBiYdJlT0X92geAtQbq5OPrT/27DBV6h3YydBoozkVEaZp
Bvbz27URCmOw2e4psQctUBuVrTPirjqEwOql/SqqJsMIdWQ6oXLy235iuGzDgx+p
Fi8s5azIOjbjFnc4OBols94L3oZxyIf+lUXgNBcvQ1wbWBlo+V1hyRWLSvLPLAtr
3eeuQZ5HTqTSZSaMKfFrH10hG06h7Zla7oYxSn0GJsgu/aI1STGFHenjNeNRyFb4
Qcofa1uD1LTI/r7EKL1I25n6eiABGw0KNDvow/ZtP9Kmx2QobEsWUbPfvkX1ogdj
plBjPb1jywhCxKfdcYv+f4er+X1AnUyoYNi7EiifiNys7nmVG4+aFEZyUULPrB2g
bHE=
-----END CERTIFICATE-----
1 change: 1 addition & 0 deletions checksums/nameable-1.1.0.gem.sha512
@@ -0,0 +1 @@
294b882dbf36a5eadb5f9ee1e22262d403024e8c1263f22a0af84e9402e9b0236b0e6bb022342ae95e8e384389c64ed22d057f3f8c1e077ff313cf4f93ec5f23
1 change: 1 addition & 0 deletions checksums/nameable-1.1.1.gem.sha512
@@ -0,0 +1 @@
3da59e4a80b73488ec9745fcb9ca31b08db3e603df7b1ac0c572c4740f29b703563e47b3fff879a9e1cd5f103fcbf2883c8cfa146193924e0d351c7fe719ce38
2 changes: 1 addition & 1 deletion lib/nameable/version.rb
@@ -1,3 +1,3 @@
module Nameable
VERSION = "1.1.0"
VERSION = "1.1.1"
end
14 changes: 10 additions & 4 deletions nameable.gemspec
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
spec.authors = ['Chris Horn']
spec.email = ['chorn@chorn.com']
spec.summary = 'Parse names into components.'
spec.description = 'A library that provides parsing and output of person names.'
spec.description = 'A library that provides parsing and output of person names, as well as Gender & Ethnicity matching.'
spec.homepage = 'https://github.com/chorn/nameable'
spec.license = 'MIT'

Expand All @@ -18,11 +18,17 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_development_dependency 'bundler', '~> 1.6', '>= 1.6.2'
signing_key = File.expand_path("~/.certs/chorn@chorn.com-rubygems.key")
if File.file?(signing_key)
spec.signing_key = signing_key
spec.cert_chain = ['certs/chorn.pem']
end

spec.add_development_dependency 'bundler', '~> 1.6'
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
spec.add_development_dependency 'guard', '~> 2.12', '>= 2.12.6'
spec.add_development_dependency 'guard', '~> 2.12'
spec.add_development_dependency 'guard-bundler', '~> 2.1'
spec.add_development_dependency 'guard-rspec', '~> 4.5'
spec.add_development_dependency 'rake', '~> 10.4'
spec.add_development_dependency 'rspec', '~> 3.2'
spec.add_development_dependency 'rspec', '~> 3.3'
end

0 comments on commit 917c134

Please sign in to comment.