Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

pull in derek's changes and support activesupport 3 better

  • Loading branch information...
commit bad071a052a5f80c8c904c50f05aa2620520504b 1 parent 5cfa4d3
@seamusabshere authored
View
1  VERSION
@@ -1 +0,0 @@
-0.1.5
View
31 common_name.gemspec
@@ -3,30 +3,23 @@ $:.push File.expand_path('../lib', __FILE__)
require 'common_name/version'
Gem::Specification.new do |s|
- s.name = %q{common_name}
- s.version = CommonName::VERSION
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Seamus Abshere"]
- s.date = %q{2010-03-30}
+ s.name = "common_name"
+ s.version = CommonName::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ['Seamus Abshere', 'Derek Kastner']
+ s.email = ["seamus@abshere.net"]
+ s.homepage = 'http://github.com/seamusabshere/common_name'
+ s.summary = %q{Provides methods like User.common_name (#=> "user") and User.common_plural_symbol (#=> :users)}
s.description = %q{Provides methods like User.common_name (#=> "user") and User.common_plural_symbol (#=> :users) so that you don't have to chain humanize/downcase/etc. etc.'}
- s.email = %q{seamus@abshere.net}
- s.extra_rdoc_files = [
- "LICENSE",
- "README.rdoc"
- ]
+
+ s.rubyforge_project = "commonname"
+
s.files = `git ls-files`.split("\n")
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"]
- s.homepage = %q{http://github.com/seamusabshere/common_name}
- s.rdoc_options = ["--charset=UTF-8"]
- s.rubyforge_project = %q{commonname}
- s.rubygems_version = %q{1.3.6}
- s.summary = %q{DRY up humanize/downcase/underscore/pluralize/to_sym/etc for names that we use all the time.}
-
+
s.add_development_dependency 'bundler'
s.add_development_dependency 'shoulda'
s.add_runtime_dependency 'activesupport', '>= 2.3.4'
-end
-
+end
View
19 lib/common_name.rb
@@ -1,3 +1,15 @@
+require 'active_support'
+require 'active_support/version'
+%w{
+ active_support/inflector
+}.each do |active_support_3_requirement|
+ require active_support_3_requirement
+end if ::ActiveSupport::VERSION::MAJOR == 3
+
+if defined?(::Rails)
+ require 'common_name/railtie'
+end
+
# This library comes out of my frustration with seeing lines like
#
# BusCompany.name.underscore.humanize.downcase.pluralize #=> "bus companies"
@@ -7,13 +19,6 @@
# See <tt>README</tt> for more information.
#
# Copyright (c) 2009 Seamus Abshere. See LICENSE for details.
-
-require 'active_support'
-
-if defined?(Rails)
- require 'common_name/railtie'
-end
-
module CommonName
def self.included(klass)
klass.extend ClassMethods
View
10 lib/common_name/railtie.rb
@@ -1,20 +1,20 @@
module CommonName
- class Railtie < Rails::Railtie
+ class Railtie < ::Rails::Railtie
initializer 'ActiveRecord' do
- ActiveRecord::Base.class_eval do
+ ::ActiveRecord::Base.class_eval do
def self._common_name
name.underscore
end
- include CommonName
+ include ::CommonName
end
end
initializer 'ActionController' do
- ActionController::Base.class_eval do
+ ::ActionController::Base.class_eval do
def self._common_name
controller_name.singularize
end
- include CommonName
+ include ::CommonName
end
end
end
View
2  lib/common_name/version.rb
@@ -1,3 +1,3 @@
module CommonName
- VERSION = '0.1.5'
+ VERSION = '0.1.6'
end
Please sign in to comment.
Something went wrong with that request. Please try again.