nameable_record 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,21 +1,4 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --format documentation
3
+ --backtrace
4
+ --debug
data/.rvmrc ADDED
@@ -0,0 +1,2 @@
1
+ rvm use ruby-1.8.7-p334@nameable_record
2
+ rvm info
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source :rubygems
2
+
3
+ group :development, :test do
4
+ gem 'ruby-debug'
5
+ gem 'guard'
6
+ gem 'rb-fsevent'
7
+ gem 'growl'
8
+ gem 'guard-rspec'
9
+ gem 'guard-shell'
10
+ gem 'sqlite3-ruby', :require => 'sqlite3'
11
+ end
12
+
13
+ # Specify your gem's dependencies in geonames_client.gemspec
14
+ gemspec
15
+
data/Gemfile.lock ADDED
@@ -0,0 +1,134 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ nameable_record (1.0.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ actionmailer (3.1.0)
10
+ actionpack (= 3.1.0)
11
+ mail (~> 2.3.0)
12
+ actionpack (3.1.0)
13
+ activemodel (= 3.1.0)
14
+ activesupport (= 3.1.0)
15
+ builder (~> 3.0.0)
16
+ erubis (~> 2.7.0)
17
+ i18n (~> 0.6)
18
+ rack (~> 1.3.2)
19
+ rack-cache (~> 1.0.3)
20
+ rack-mount (~> 0.8.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.0.0)
23
+ activemodel (3.1.0)
24
+ activesupport (= 3.1.0)
25
+ bcrypt-ruby (~> 3.0.0)
26
+ builder (~> 3.0.0)
27
+ i18n (~> 0.6)
28
+ activerecord (3.1.0)
29
+ activemodel (= 3.1.0)
30
+ activesupport (= 3.1.0)
31
+ arel (~> 2.2.1)
32
+ tzinfo (~> 0.3.29)
33
+ activeresource (3.1.0)
34
+ activemodel (= 3.1.0)
35
+ activesupport (= 3.1.0)
36
+ activesupport (3.1.0)
37
+ multi_json (~> 1.0)
38
+ arel (2.2.1)
39
+ bcrypt-ruby (3.0.1)
40
+ builder (3.0.0)
41
+ columnize (0.3.4)
42
+ diff-lcs (1.1.3)
43
+ erubis (2.7.0)
44
+ gem-dandy (0.2.1)
45
+ trollop (= 1.16.2)
46
+ growl (1.0.3)
47
+ guard (0.7.0)
48
+ thor (~> 0.14.6)
49
+ guard-rspec (0.4.5)
50
+ guard (>= 0.4.0)
51
+ guard-shell (0.1.1)
52
+ guard (>= 0.2.0)
53
+ hike (1.2.1)
54
+ i18n (0.6.0)
55
+ linecache (0.46)
56
+ rbx-require-relative (> 0.0.4)
57
+ mail (2.3.0)
58
+ i18n (>= 0.4.0)
59
+ mime-types (~> 1.16)
60
+ treetop (~> 1.4.8)
61
+ mime-types (1.16)
62
+ multi_json (1.0.3)
63
+ polyglot (0.3.2)
64
+ rack (1.3.3)
65
+ rack-cache (1.0.3)
66
+ rack (>= 0.4)
67
+ rack-mount (0.8.3)
68
+ rack (>= 1.0.0)
69
+ rack-ssl (1.3.2)
70
+ rack
71
+ rack-test (0.6.1)
72
+ rack (>= 1.0)
73
+ rails (3.1.0)
74
+ actionmailer (= 3.1.0)
75
+ actionpack (= 3.1.0)
76
+ activerecord (= 3.1.0)
77
+ activeresource (= 3.1.0)
78
+ activesupport (= 3.1.0)
79
+ bundler (~> 1.0)
80
+ railties (= 3.1.0)
81
+ railties (3.1.0)
82
+ actionpack (= 3.1.0)
83
+ activesupport (= 3.1.0)
84
+ rack-ssl (~> 1.3.2)
85
+ rake (>= 0.8.7)
86
+ rdoc (~> 3.4)
87
+ thor (~> 0.14.6)
88
+ rake (0.9.2)
89
+ rb-fsevent (0.4.3.1)
90
+ rbx-require-relative (0.0.5)
91
+ rdoc (3.9.4)
92
+ rspec (2.6.0)
93
+ rspec-core (~> 2.6.0)
94
+ rspec-expectations (~> 2.6.0)
95
+ rspec-mocks (~> 2.6.0)
96
+ rspec-core (2.6.4)
97
+ rspec-expectations (2.6.0)
98
+ diff-lcs (~> 1.1.2)
99
+ rspec-mocks (2.6.0)
100
+ ruby-debug (0.10.4)
101
+ columnize (>= 0.1)
102
+ ruby-debug-base (~> 0.10.4.0)
103
+ ruby-debug-base (0.10.4)
104
+ linecache (>= 0.3)
105
+ sprockets (2.0.0)
106
+ hike (~> 1.2)
107
+ rack (~> 1.0)
108
+ tilt (~> 1.1, != 1.3.0)
109
+ sqlite3 (1.3.4)
110
+ sqlite3-ruby (1.3.3)
111
+ sqlite3 (>= 1.3.3)
112
+ thor (0.14.6)
113
+ tilt (1.3.3)
114
+ treetop (1.4.10)
115
+ polyglot
116
+ polyglot (>= 0.3.1)
117
+ trollop (1.16.2)
118
+ tzinfo (0.3.29)
119
+
120
+ PLATFORMS
121
+ ruby
122
+
123
+ DEPENDENCIES
124
+ gem-dandy
125
+ growl
126
+ guard
127
+ guard-rspec
128
+ guard-shell
129
+ nameable_record!
130
+ rails
131
+ rb-fsevent
132
+ rspec
133
+ ruby-debug
134
+ sqlite3-ruby
data/Guardfile ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ guard 'rspec', :version => 2, :all_on_start => true, :all_after_pass => false, :cli => '--color --format doc' do
4
+ watch( %r{^spec/.+_spec\.rb$} )
5
+ watch( %r{^lib/(.+)\.rb$} ) { |m| "spec/lib/#{m[1]}_spec.rb" }
6
+ watch( 'spec/spec_helper.rb' ) { "spec" }
7
+ end
data/README.rdoc CHANGED
@@ -1,25 +0,0 @@
1
- = nameable_record
2
-
3
- Description goes here.
4
-
5
- == Note on Patches/Pull Requests
6
-
7
- * Fork the project.
8
- * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
- * Send me a pull request. Bonus points for topic branches.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2009 C. Jason Harrelson (midas)
18
-
19
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
20
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,45 +1 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "nameable_record"
8
- gem.summary = %Q{Encapsulates the composed of pattern for names into any easy to use library.}
9
- gem.description = %Q{Encapsulates the composed of pattern for names into any easy to use library.}
10
- gem.email = "jason@lookforwardenterprises.com"
11
- gem.homepage = "http://github.com/midas/nameable_record"
12
- gem.authors = ["C. Jason Harrelson"]
13
- gem.add_development_dependency "rspec", ">= 1.2.9"
14
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
- end
16
- Jeweler::GemcutterTasks.new
17
- rescue LoadError
18
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
- end
20
-
21
- require 'spec/rake/spectask'
22
- Spec::Rake::SpecTask.new(:spec) do |spec|
23
- spec.libs << 'lib' << 'spec'
24
- spec.spec_files = FileList['spec/**/*_spec.rb']
25
- end
26
-
27
- Spec::Rake::SpecTask.new(:rcov) do |spec|
28
- spec.libs << 'lib' << 'spec'
29
- spec.pattern = 'spec/**/*_spec.rb'
30
- spec.rcov = true
31
- end
32
-
33
- task :spec => :check_dependencies
34
-
35
- task :default => :spec
36
-
37
- require 'rake/rdoctask'
38
- Rake::RDocTask.new do |rdoc|
39
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
-
41
- rdoc.rdoc_dir = 'rdoc'
42
- rdoc.title = "nameable_record #{version}"
43
- rdoc.rdoc_files.include('README*')
44
- rdoc.rdoc_files.include('lib/**/*.rb')
45
- end
1
+ require "bundler/gem_tasks"
@@ -1,32 +1,24 @@
1
- module NameableRecord
2
- module ActiveRecordExtensions
3
- def self.included( base )
4
- base.extend ActsMethods
5
- end
1
+ module NameableRecord::ActiveRecordExtensions
6
2
 
7
- module ActsMethods
8
- def has_name( *args )
9
- unless included_modules.include? InstanceMethods
10
- self.class_eval { extend ClassMethods }
11
- include InstanceMethods
12
- end
13
- initialize_compositions( args )
14
- end
3
+ def self.included( base )
4
+ base.extend ActsMethods
5
+ end
15
6
 
16
- alias_method :has_names, :has_name
17
- end
7
+ module ActsMethods
18
8
 
19
- module ClassMethods
20
- def initialize_compositions( attrs )
21
- attrs.each do |attr|
22
- composed_of attr, :class_name => "NameableRecord::Name", :mapping => [["#{attr}_last", "last"], ["#{attr}_first", "first"],
23
- ["#{attr}_prefix", "prefix"], ["#{attr}_middle", "middle"], ["#{attr}_suffix", "suffix"]]
24
- end
9
+ def has_name( *args )
10
+ args.each do |attr|
11
+ composed_of attr, :class_name => "NameableRecord::Name", :mapping => [["#{attr}_last", "last"],
12
+ ["#{attr}_first", "first"],
13
+ ["#{attr}_prefix", "prefix"],
14
+ ["#{attr}_middle", "middle"],
15
+ ["#{attr}_suffix", "suffix"]]
25
16
  end
26
17
  end
27
18
 
28
- module InstanceMethods
19
+ alias_method :has_names, :has_name
29
20
 
30
- end
31
21
  end
32
- end
22
+
23
+ end
24
+