diff --git a/.gitignore b/.gitignore index c1e0daf..466c187 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,5 @@ -## MAC OS -.DS_Store - -## TEXTMATE -*.tmproj -tmtags - -## EMACS -*~ -\#* -.\#* - -## VIM -*.swp - -## PROJECT::GENERAL -coverage -rdoc -pkg - -## PROJECT::SPECIFIC +*.gem +.bundle +Gemfile.lock +pkg/* +.rvmrc diff --git a/Gemfile b/Gemfile index e54960b..5a6aa00 100644 --- a/Gemfile +++ b/Gemfile @@ -3,4 +3,5 @@ source "http://rubygems.org" # Specify your gem's dependencies in indefinite_article.gemspec gemspec -gem 'activesupport', '3.0.10' +#gem 'activesupport', '3.0.10' +#gem 'i18n', '~>0.5.0' diff --git a/Rakefile b/Rakefile index 2550d5e..c702cfc 100644 --- a/Rakefile +++ b/Rakefile @@ -1,52 +1 @@ -require 'rubygems' -require 'rake' - -begin - require 'jeweler' - Jeweler::Tasks.new do |gem| - gem.name = "indefinite_article" - gem.summary = %Q{Indefinite articles for stringlike classes in Ruby} - gem.description = %Q{Adds indefinite article ('a' vs. 'an') methods to String and Symbol} - gem.email = "andy@rossmeissl.net" - gem.homepage = "http://github.com/rossmeissl/indefinite_article" - gem.authors = ["Andy Rossmeissl"] - # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings - end - Jeweler::GemcutterTasks.new -rescue LoadError - puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler" -end - -require 'rake/testtask' -Rake::TestTask.new(:test) do |test| - test.libs << 'lib' << 'test' - test.pattern = 'test/**/test_*.rb' - test.verbose = true -end - -begin - require 'rcov/rcovtask' - Rcov::RcovTask.new do |test| - test.libs << 'test' - test.pattern = 'test/**/test_*.rb' - test.verbose = true - end -rescue LoadError - task :rcov do - abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov" - end -end - -task :test => :check_dependencies - -task :default => :test - -require 'rake/rdoctask' -Rake::RDocTask.new do |rdoc| - version = File.exist?('VERSION') ? File.read('VERSION') : "" - - rdoc.rdoc_dir = 'rdoc' - rdoc.title = "indefinite_article #{version}" - rdoc.rdoc_files.include('README*') - rdoc.rdoc_files.include('lib/**/*.rb') -end +require 'bundler/gem_tasks' diff --git a/VERSION b/VERSION index 6e8bf73..17e51c3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0 +0.1.1 diff --git a/indefinite_article.gemspec b/indefinite_article.gemspec index 1d8daca..48863ff 100644 --- a/indefinite_article.gemspec +++ b/indefinite_article.gemspec @@ -8,8 +8,8 @@ Gem::Specification.new do |s| s.authors = ["Kevin English"] s.email = ["kenglish@gmail.com"] s.homepage = "" - s.summary = %q{TODO: Write a gem summary} - s.description = %q{TODO: Write a gem description} + s.summary = %q{Adds indefinite article methods to String and Symbol} + s.description = %q{Adds indefinite article methods to String and Symbol} s.rubyforge_project = "indefinite_article" @@ -17,4 +17,23 @@ Gem::Specification.new do |s| s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] +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_runtime_dependency(%q, ['>= 3.0.1']) + s.add_runtime_dependency(%q, ['~>0.5.0']) + + s.add_development_dependency(%q,['>= 3.0.1']) + s.add_development_dependency(%q, ['~>0.5.0']) + else + s.add_dependency(%q, ['>= 3.0.1']) + s.add_dependency(%q, ['~>0.5.0']) + end + else + s.add_dependency(%q, ['>= 3.0.1']) + s.add_dependency(%q, ['~>0.5.0']) + end + + end diff --git a/lib/indefinite_article.rb b/lib/indefinite_article.rb index c33ddc9..c26a9e6 100644 --- a/lib/indefinite_article.rb +++ b/lib/indefinite_article.rb @@ -1,5 +1,6 @@ require 'indefinite_article/articulated' -require 'activesupport' +require 'active_support' +require 'active_support/core_ext/string' module IndefiniteArticle WORDS_WITH_INITIAL_VOWELS_THAT_ACT_LIKE_WORDS_WITH_INITIAL_CONSONANTS = %w(one united) diff --git a/lib/indefinite_article/articulated.rb b/lib/indefinite_article/articulated.rb index aa07eb1..127102e 100644 --- a/lib/indefinite_article/articulated.rb +++ b/lib/indefinite_article/articulated.rb @@ -3,7 +3,7 @@ module Articulated def indefinite_article if ::IndefiniteArticle::WORDS_WITH_INITIAL_VOWELS_THAT_ACT_LIKE_WORDS_WITH_INITIAL_CONSONANTS.include? to_s._first_word_for_indefinite_article._first_term_for_indefinite_article.downcase ::IndefiniteArticle::INDEFINITE_ARTICLES[:consonant] - elsif VOWELS.include? to_s.first.downcase + elsif VOWELS.include? self.to_s.first.downcase ::IndefiniteArticle::INDEFINITE_ARTICLES[:vowel] else ::IndefiniteArticle::INDEFINITE_ARTICLES[:consonant] diff --git a/test/test_indefinite_article.rb b/test/test_indefinite_article.rb old mode 100644 new mode 100755 index 706a459..fbbb036 --- a/test/test_indefinite_article.rb +++ b/test/test_indefinite_article.rb @@ -1,9 +1,11 @@ -require 'helper' +require_relative 'helper' class TestIndefiniteArticle < Test::Unit::TestCase def setup end - + def test_active_support + assert_equal 'banana'.first, 'b' + end def test_indefinite_article_selection assert_equal 'a', 'banana'.indefinite_article assert_equal 'an', 'apple'.indefinite_article