Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added bundler, rspec 2, made the Rakefile less lame, and fixed some u…

…gliness
  • Loading branch information...
commit f9a4e8539d521cc6f5f8f647d7cc1f85c2690dd9 1 parent f70e031
Chris Horn authored
10 Gemfile
View
@@ -0,0 +1,10 @@
+source :rubygems
+
+group :development do
+ gem "bundler"
+ gem "jeweler"
+end
+
+group :test do
+ gem "rspec"
+end
30 Gemfile.lock
View
@@ -0,0 +1,30 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ diff-lcs (1.1.3)
+ git (1.2.5)
+ jeweler (1.8.4)
+ bundler (~> 1.0)
+ git (>= 1.2.5)
+ rake
+ rdoc
+ json (1.7.4)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rspec (2.11.0)
+ rspec-core (~> 2.11.0)
+ rspec-expectations (~> 2.11.0)
+ rspec-mocks (~> 2.11.0)
+ rspec-core (2.11.1)
+ rspec-expectations (2.11.2)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.11.1)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bundler
+ jeweler
+ rspec
0  LICENSE 100755 → 100644
View
File mode changed
0  README.rdoc 100755 → 100644
View
File mode changed
80 Rakefile 100755 → 100644
View
@@ -1,57 +1,39 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-require 'rubygems/specification'
-require 'date'
-require 'spec/rake/spectask'
-
-GEM = "nameable"
-GEM_VERSION = "0.5.0"
-AUTHOR = "Chris Horn"
-EMAIL = "chorn@chorn.com"
-HOMEPAGE = "http://github.com/chorn/nameable"
-SUMMARY = "A ruby library to parse people names into parts and reformat them."
-
-spec = Gem::Specification.new do |s|
- s.name = GEM
- s.version = GEM_VERSION
- s.platform = Gem::Platform::RUBY
- s.has_rdoc = true
- s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
- s.summary = SUMMARY
- s.description = s.summary
- s.author = AUTHOR
- s.email = EMAIL
- s.homepage = HOMEPAGE
+# encoding: utf-8
- # Uncomment this to add a dependency
- # s.add_dependency "foo"
-
- s.require_path = 'lib'
- s.autorequire = GEM
- s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
+require 'rubygems'
+require 'bundler'
+begin
+ Bundler.setup(:default, :development)
+rescue Bundler::BundlerError => e
+ $stderr.puts e.message
+ $stderr.puts "Run `bundle install` to install missing gems"
+ exit e.status_code
end
-
-task :default => :spec
-
-desc "Run specs"
-Spec::Rake::SpecTask.new do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.spec_opts = %w(-fs --color)
+require 'rake'
+
+require 'jeweler'
+Jeweler::Tasks.new do |gem|
+ gem.name = "nameable"
+ gem.homepage = "https://github.com/chorn/nameable"
+ gem.license = "MIT"
+ gem.summary = %Q{Provides parsing and output of person names.}
+ gem.description = %Q{A gem that provides parsing and output of person names.}
+ gem.email = "chorn@chorn.com"
+ gem.authors = ["Chris Horn"]
+ gem.files = FileList['lib/**/*.rb', 'Gemfile*', '[A-Z]*', 'Rakefile', 'spec/*', 'examples/*'].to_a
end
+Jeweler::RubygemsDotOrgTasks.new
-
-Rake::GemPackageTask.new(spec) do |pkg|
- pkg.gem_spec = spec
+require 'rspec/core'
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = FileList['spec/**/*_spec.rb']
end
-desc "install the gem locally"
-task :install => [:package] do
- sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
+RSpec::Core::RakeTask.new(:rcov) do |spec|
+ spec.pattern = 'spec/**/*_spec.rb'
+ spec.rcov = true
end
-desc "create a gemspec file"
-task :make_spec do
- File.open("#{GEM}.gemspec", "w") do |file|
- file.puts spec.to_ruby
- end
-end
+task :default => :spec
+
0  TODO 100755 → 100644
View
File mode changed
2  VERSION
View
@@ -1 +1 @@
-0.0.0
+0.5.1
1  examples/test.rb
View
@@ -15,6 +15,7 @@
Chris Horn T.I.T.L.E.
Chris Horn II
Chris Horn II Esquire
+Chris Horn I.I.I.
Chris O'Horn
Chris McHorn
Chris Von Horn
4 lib/nameable.rb
View
@@ -32,10 +32,10 @@ module Patterns
"Ph.D." => /^\(*(phd\.?)\)*$/i
}
- SUFFIX_GENERATIONAL_ROMAN = /^\(*[IVX\.]+\)*$/i
+ SUFFIX_GENERATIONAL_ROMAN = /^\(*[IVX.]+\)*$/i
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
SUFFIX_PROFESSIONAL = /^(PE|CSA|CPA|CPL|CME|CEng|OFM|CSV|Douchebag)$/i
- SUFFIX_ABBREVIATION = /^[A-Z\.]+[A-Z\.]+$/ # It should be at least 2 letters
+ SUFFIX_ABBREVIATION = /^[A-Z.]+[A-Z.]+$/ # It should be at least 2 letters
LAST_NAME_PRE_DANGLERS = /^(mc|vere|von|van|da|de|del|della|di|da|pietro|vanden|du|st|la|ter|ten)$/i
O_LAST_NAME_PRE_CONCATS = /^(o'|o`)$/i
77 nameable.gemspec 100755 → 100644
View
@@ -1,26 +1,57 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
+# -*- encoding: utf-8 -*-
+
Gem::Specification.new do |s|
- s.name = "nameable"
- s.version = "0.5.0"
- s.date = "2012-06-06"
- s.summary = "Provides parsing and output of person names."
- s.email = "chorn@chorn.com"
- s.homepage = "http://github.com/chorn/nameable"
+ s.name = "nameable"
+ s.version = "0.5.1"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Chris Horn"]
+ s.date = "2012-08-10"
s.description = "A gem that provides parsing and output of person names."
- s.has_rdoc = true
- s.authors = ["Chris Horn"]
- s.files = [ "LICENSE",
- "README.rdoc",
- "Rakefile",
- "TODO",
- "nameable.gemspec",
- "lib/nameable.rb",
- "script/destroy",
- "script/generate",
- "spec/nameable_spec.rb",
- "spec/spec_helper.rb",
- "examples/test.rb",
- "examples/nameable_web_service.rb"
- ]
- s.test_files = []
- s.rdoc_options = []
+ s.email = "chorn@chorn.com"
+ s.extra_rdoc_files = [
+ "LICENSE",
+ "README.rdoc",
+ "TODO"
+ ]
+ s.files = [
+ "Gemfile",
+ "Gemfile.lock",
+ "History.txt",
+ "LICENSE",
+ "README.rdoc",
+ "Rakefile",
+ "TODO",
+ "VERSION",
+ "examples/nameable_web_service.rb",
+ "examples/test.rb",
+ "lib/nameable.rb",
+ "spec/nameable_spec.rb",
+ "spec/spec.opts",
+ "spec/spec_helper.rb"
+ ]
+ s.homepage = "https://github.com/chorn/nameable"
+ s.licenses = ["MIT"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = "1.8.23"
+ s.summary = "Provides parsing and output of person names."
+
+ if s.respond_to? :specification_version then
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_development_dependency(%q<bundler>, [">= 0"])
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
+ else
+ s.add_dependency(%q<bundler>, [">= 0"])
+ s.add_dependency(%q<jeweler>, [">= 0"])
+ end
+ else
+ s.add_dependency(%q<bundler>, [">= 0"])
+ s.add_dependency(%q<jeweler>, [">= 0"])
+ end
end
+
10 spec/nameable_spec.rb 100755 → 100644
View
@@ -1,21 +1,21 @@
-require File.dirname(__FILE__) + '/spec_helper'
+require 'spec_helper'
describe Nameable::Latin do
describe "with 'Mr. Chris Horn PhD" do
subject { Nameable::Latin.new.parse("Mr. Chris Horn PhD") }
-
+
it("should extract prefix") { subject.prefix.should == "Mr." }
it("should extract first name") { subject.first.should == "Chris" }
it("should extract last name") { subject.last.should == "Horn" }
it("should extract and normalize suffix") { subject.suffix.should == "Ph.D." }
end
-
+
describe "with 'Chris Old Biscuit Barrel Horn'" do
subject { Nameable::Latin.new.parse("Chris Old Biscuit Barrel Horn") }
-
+
it("should extract first name") { subject.first.should == "Chris" }
it("should extract middle name") { subject.middle.should == "Old Biscuit Barrel" }
it("should extract last name") { subject.last.should == "Horn" }
end
-
+
end
0  spec/spec.opts 100755 → 100644
View
File mode changed
11 spec/spec_helper.rb 100755 → 100644
View
@@ -1,10 +1,9 @@
-$LOAD_PATH.push File.join(File.dirname(__FILE__), '..', 'lib')
-
-require "rubygems"
-require "spec"
-require "active_support"
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+$LOAD_PATH.unshift(File.dirname(__FILE__))
+require "bundler/setup"
+Bundler.require(:test)
require "nameable"
-Spec::Runner.configure do |config|
+RSpec.configure do |config|
# config.mock_with :mocha
end
Please sign in to comment.
Something went wrong with that request. Please try again.