common_name 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +3 -0
- data/Rakefile +2 -25
- data/common_name.gemspec +19 -49
- data/lib/common_name.rb +12 -3
- data/lib/common_name/railtie.rb +21 -0
- data/lib/common_name/version.rb +3 -0
- metadata +52 -14
- data/VERSION +0 -1
data/Gemfile
ADDED
data/Rakefile
CHANGED
@@ -1,25 +1,5 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "common_name"
|
8
|
-
gem.summary = %Q{DRY up humanize/downcase/underscore/pluralize/to_sym/etc for names that we use all the time.}
|
9
|
-
gem.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.'}
|
10
|
-
gem.email = "seamus@abshere.net"
|
11
|
-
gem.homepage = "http://github.com/seamusabshere/common_name"
|
12
|
-
gem.authors = ["Seamus Abshere"]
|
13
|
-
gem.add_dependency 'activesupport', '>=2.3.4'
|
14
|
-
gem.rubyforge_project = "commonname"
|
15
|
-
end
|
16
|
-
Jeweler::GemcutterTasks.new
|
17
|
-
Jeweler::RubyforgeTasks.new do |rubyforge|
|
18
|
-
rubyforge.doc_task = "rdoc"
|
19
|
-
end
|
20
|
-
rescue LoadError
|
21
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
22
|
-
end
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
23
3
|
|
24
4
|
require 'rake/testtask'
|
25
5
|
Rake::TestTask.new(:test) do |test|
|
@@ -41,9 +21,6 @@ rescue LoadError
|
|
41
21
|
end
|
42
22
|
end
|
43
23
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
24
|
task :default => :test
|
48
25
|
|
49
26
|
require 'rake/rdoctask'
|
data/common_name.gemspec
CHANGED
@@ -1,55 +1,25 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'common_name/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
9
|
-
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
6
|
+
s.name = "common_name"
|
7
|
+
s.version = CommonName::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ['Seamus Abshere', 'Derek Kastner']
|
10
|
+
s.email = ["seamus@abshere.net"]
|
11
|
+
s.homepage = 'http://github.com/seamusabshere/common_name'
|
12
|
+
s.summary = %q{Provides methods like User.common_name (#=> "user") and User.common_plural_symbol (#=> :users)}
|
13
13
|
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.'}
|
14
|
-
s.email = %q{seamus@abshere.net}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"common_name.gemspec",
|
27
|
-
"lib/common_name.rb",
|
28
|
-
"test/common_name_test.rb",
|
29
|
-
"test/test_helper.rb"
|
30
|
-
]
|
31
|
-
s.homepage = %q{http://github.com/seamusabshere/common_name}
|
32
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
33
|
-
s.require_paths = ["lib"]
|
34
|
-
s.rubyforge_project = %q{commonname}
|
35
|
-
s.rubygems_version = %q{1.3.6}
|
36
|
-
s.summary = %q{DRY up humanize/downcase/underscore/pluralize/to_sym/etc for names that we use all the time.}
|
37
|
-
s.test_files = [
|
38
|
-
"test/common_name_test.rb",
|
39
|
-
"test/test_helper.rb"
|
40
|
-
]
|
41
14
|
|
42
|
-
|
43
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
|
-
s.specification_version = 3
|
45
|
-
|
46
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
47
|
-
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.4"])
|
48
|
-
else
|
49
|
-
s.add_dependency(%q<activesupport>, [">= 2.3.4"])
|
50
|
-
end
|
51
|
-
else
|
52
|
-
s.add_dependency(%q<activesupport>, [">= 2.3.4"])
|
53
|
-
end
|
54
|
-
end
|
15
|
+
s.rubyforge_project = "commonname"
|
55
16
|
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_development_dependency 'bundler'
|
23
|
+
s.add_development_dependency 'shoulda'
|
24
|
+
s.add_runtime_dependency 'activesupport', '>= 2.3.4'
|
25
|
+
end
|
data/lib/common_name.rb
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
require 'active_support'
|
2
|
+
require 'active_support/version'
|
3
|
+
%w{
|
4
|
+
active_support/inflector
|
5
|
+
}.each do |active_support_3_requirement|
|
6
|
+
require active_support_3_requirement
|
7
|
+
end if ::ActiveSupport::VERSION::MAJOR == 3
|
8
|
+
|
9
|
+
if defined?(::Rails)
|
10
|
+
require 'common_name/railtie'
|
11
|
+
end
|
12
|
+
|
1
13
|
# This library comes out of my frustration with seeing lines like
|
2
14
|
#
|
3
15
|
# BusCompany.name.underscore.humanize.downcase.pluralize #=> "bus companies"
|
@@ -7,9 +19,6 @@
|
|
7
19
|
# See <tt>README</tt> for more information.
|
8
20
|
#
|
9
21
|
# Copyright (c) 2009 Seamus Abshere. See LICENSE for details.
|
10
|
-
|
11
|
-
require 'active_support'
|
12
|
-
|
13
22
|
module CommonName
|
14
23
|
def self.included(klass)
|
15
24
|
klass.extend ClassMethods
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module CommonName
|
2
|
+
class Railtie < ::Rails::Railtie
|
3
|
+
initializer 'ActiveRecord' do
|
4
|
+
::ActiveRecord::Base.class_eval do
|
5
|
+
def self._common_name
|
6
|
+
name.underscore
|
7
|
+
end
|
8
|
+
include ::CommonName
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
initializer 'ActionController' do
|
13
|
+
::ActionController::Base.class_eval do
|
14
|
+
def self._common_name
|
15
|
+
controller_name.singularize
|
16
|
+
end
|
17
|
+
include ::CommonName
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,54 +1,88 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: common_name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Seamus Abshere
|
14
|
+
- Derek Kastner
|
13
15
|
autorequire:
|
14
16
|
bindir: bin
|
15
17
|
cert_chain: []
|
16
18
|
|
17
|
-
date:
|
19
|
+
date: 2011-03-02 00:00:00 -06:00
|
18
20
|
default_executable:
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
23
|
+
name: bundler
|
22
24
|
prerelease: false
|
23
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
version: "0"
|
34
|
+
type: :development
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: shoulda
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: activesupport
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
24
55
|
requirements:
|
25
56
|
- - ">="
|
26
57
|
- !ruby/object:Gem::Version
|
58
|
+
hash: 11
|
27
59
|
segments:
|
28
60
|
- 2
|
29
61
|
- 3
|
30
62
|
- 4
|
31
63
|
version: 2.3.4
|
32
64
|
type: :runtime
|
33
|
-
version_requirements: *
|
65
|
+
version_requirements: *id003
|
34
66
|
description: 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.'
|
35
|
-
email:
|
67
|
+
email:
|
68
|
+
- seamus@abshere.net
|
36
69
|
executables: []
|
37
70
|
|
38
71
|
extensions: []
|
39
72
|
|
40
|
-
extra_rdoc_files:
|
41
|
-
|
42
|
-
- README.rdoc
|
73
|
+
extra_rdoc_files: []
|
74
|
+
|
43
75
|
files:
|
44
76
|
- .document
|
45
77
|
- .gitignore
|
78
|
+
- Gemfile
|
46
79
|
- LICENSE
|
47
80
|
- README.rdoc
|
48
81
|
- Rakefile
|
49
|
-
- VERSION
|
50
82
|
- common_name.gemspec
|
51
83
|
- lib/common_name.rb
|
84
|
+
- lib/common_name/railtie.rb
|
85
|
+
- lib/common_name/version.rb
|
52
86
|
- test/common_name_test.rb
|
53
87
|
- test/test_helper.rb
|
54
88
|
has_rdoc: true
|
@@ -56,31 +90,35 @@ homepage: http://github.com/seamusabshere/common_name
|
|
56
90
|
licenses: []
|
57
91
|
|
58
92
|
post_install_message:
|
59
|
-
rdoc_options:
|
60
|
-
|
93
|
+
rdoc_options: []
|
94
|
+
|
61
95
|
require_paths:
|
62
96
|
- lib
|
63
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
64
99
|
requirements:
|
65
100
|
- - ">="
|
66
101
|
- !ruby/object:Gem::Version
|
102
|
+
hash: 3
|
67
103
|
segments:
|
68
104
|
- 0
|
69
105
|
version: "0"
|
70
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
71
108
|
requirements:
|
72
109
|
- - ">="
|
73
110
|
- !ruby/object:Gem::Version
|
111
|
+
hash: 3
|
74
112
|
segments:
|
75
113
|
- 0
|
76
114
|
version: "0"
|
77
115
|
requirements: []
|
78
116
|
|
79
117
|
rubyforge_project: commonname
|
80
|
-
rubygems_version: 1.3.
|
118
|
+
rubygems_version: 1.3.7
|
81
119
|
signing_key:
|
82
120
|
specification_version: 3
|
83
|
-
summary:
|
121
|
+
summary: Provides methods like User.common_name (#=> "user") and User.common_plural_symbol (#=> :users)
|
84
122
|
test_files:
|
85
123
|
- test/common_name_test.rb
|
86
124
|
- test/test_helper.rb
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.5
|