has_meta_data 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Appraisals +14 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +60 -0
- data/LICENSE +1 -1
- data/Rakefile +28 -12
- data/lib/has_meta_data/version.rb +2 -2
- data/lib/has_meta_data.rb +3 -3
- data/spec/db/test.sqlite3 +0 -0
- data/spec/has_meta_data_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -1
- metadata +115 -68
- data/CHANGELOG.rdoc +0 -6
data/Appraisals
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
appraise "rails-3.0" do
|
2
|
+
gem "rails", "~> 3.0.12"
|
3
|
+
gem "has_meta_data", :path => "../"
|
4
|
+
end
|
5
|
+
|
6
|
+
appraise "rails-3.1" do
|
7
|
+
gem "rails", "~> 3.1.4"
|
8
|
+
gem "has_meta_data", :path => "../"
|
9
|
+
end
|
10
|
+
|
11
|
+
appraise "rails-3.2" do
|
12
|
+
gem "rails", "~> 3.2.2"
|
13
|
+
gem "has_meta_data", :path => "../"
|
14
|
+
end
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
has_meta_data (1.0.0)
|
5
|
+
activerecord (>= 3.0.0)
|
6
|
+
activesupport (>= 3.0.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activemodel (3.2.3)
|
12
|
+
activesupport (= 3.2.3)
|
13
|
+
builder (~> 3.0.0)
|
14
|
+
activerecord (3.2.3)
|
15
|
+
activemodel (= 3.2.3)
|
16
|
+
activesupport (= 3.2.3)
|
17
|
+
arel (~> 3.0.2)
|
18
|
+
tzinfo (~> 0.3.29)
|
19
|
+
activesupport (3.2.3)
|
20
|
+
i18n (~> 0.6)
|
21
|
+
multi_json (~> 1.0)
|
22
|
+
appraisal (0.4.1)
|
23
|
+
bundler
|
24
|
+
rake
|
25
|
+
arel (3.0.2)
|
26
|
+
builder (3.0.0)
|
27
|
+
diff-lcs (1.1.3)
|
28
|
+
factory_girl (2.6.4)
|
29
|
+
activesupport (>= 2.3.9)
|
30
|
+
faker (1.0.1)
|
31
|
+
i18n (~> 0.4)
|
32
|
+
i18n (0.6.0)
|
33
|
+
json (1.6.6)
|
34
|
+
multi_json (1.2.0)
|
35
|
+
rake (0.9.2.2)
|
36
|
+
rdoc (3.12)
|
37
|
+
json (~> 1.4)
|
38
|
+
rspec (2.9.0)
|
39
|
+
rspec-core (~> 2.9.0)
|
40
|
+
rspec-expectations (~> 2.9.0)
|
41
|
+
rspec-mocks (~> 2.9.0)
|
42
|
+
rspec-core (2.9.0)
|
43
|
+
rspec-expectations (2.9.0)
|
44
|
+
diff-lcs (~> 1.1.3)
|
45
|
+
rspec-mocks (2.9.0)
|
46
|
+
sqlite3 (1.3.5)
|
47
|
+
tzinfo (0.3.32)
|
48
|
+
|
49
|
+
PLATFORMS
|
50
|
+
ruby
|
51
|
+
|
52
|
+
DEPENDENCIES
|
53
|
+
appraisal (~> 0.4.0)
|
54
|
+
factory_girl (~> 2.6.2)
|
55
|
+
faker (~> 1.0.0)
|
56
|
+
has_meta_data!
|
57
|
+
rake
|
58
|
+
rdoc (~> 3.12)
|
59
|
+
rspec (~> 2.0)
|
60
|
+
sqlite3 (~> 1.3.4)
|
data/LICENSE
CHANGED
data/Rakefile
CHANGED
@@ -1,14 +1,30 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'rake'
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
require 'appraisal'
|
7
|
+
|
8
|
+
Bundler::GemHelper.install_tasks
|
9
|
+
|
10
|
+
desc 'Default: run unit tests.'
|
11
|
+
task :default => [:clean, :all]
|
12
|
+
|
13
|
+
desc "Run Specs against all Appraisals"
|
14
|
+
task :all => :spec do
|
15
|
+
Rake::Task["appraisal:install"].execute
|
16
|
+
system("bundle exec rake -s appraisal spec")
|
12
17
|
end
|
13
18
|
|
14
|
-
|
19
|
+
desc "Run Specs"
|
20
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
21
|
+
end
|
22
|
+
|
23
|
+
task :test => :spec
|
24
|
+
|
25
|
+
desc "Clean up files."
|
26
|
+
task :clean do |t|
|
27
|
+
FileUtils.rm_rf "tmp"
|
28
|
+
Dir.glob("spec/db/*.sqlite3").each {|f| FileUtils.rm f }
|
29
|
+
Dir.glob("has_meta_data-*.gem").each {|f| FileUtils.rm f }
|
30
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module HasMetaData
|
2
|
-
VERSION = "1.
|
3
|
-
end
|
2
|
+
VERSION = "1.1.0"
|
3
|
+
end
|
data/lib/has_meta_data.rb
CHANGED
@@ -22,8 +22,8 @@ module HasMetaData
|
|
22
22
|
:foreign_key => meta_data_foreign_key,
|
23
23
|
:dependent => :destroy
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
scope :with_meta, includes(:meta).where("#{meta_data_table_name}.id IS NOT NULL")
|
26
|
+
scope :without_meta, includes(:meta).where("#{meta_data_table_name}.id IS NULL")
|
27
27
|
end
|
28
28
|
|
29
29
|
# Dynamically Create Model::Meta Class
|
@@ -66,4 +66,4 @@ module HasMetaData
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
require "has_meta_data/railtie"
|
69
|
+
require "has_meta_data/railtie"
|
data/spec/db/test.sqlite3
CHANGED
Binary file
|
data/spec/has_meta_data_spec.rb
CHANGED
@@ -20,7 +20,7 @@ describe HasMetaData do
|
|
20
20
|
|
21
21
|
context "Meta model" do
|
22
22
|
it "should be defined under the Article namespace" do
|
23
|
-
Article.constants.should include('Meta')
|
23
|
+
Article.constants.map(&:to_s).should include('Meta')
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should expose #original_class as Article" do
|
@@ -72,4 +72,4 @@ describe HasMetaData do
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
end
|
75
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,7 +2,6 @@ require "rubygems"
|
|
2
2
|
require "rspec"
|
3
3
|
require "factory_girl"
|
4
4
|
require "faker"
|
5
|
-
require "rails"
|
6
5
|
require "active_record"
|
7
6
|
require "active_support"
|
8
7
|
|
@@ -16,6 +15,8 @@ load(File.dirname(__FILE__) + "/db/schema.rb")
|
|
16
15
|
|
17
16
|
require File.dirname(__FILE__) + '/../init'
|
18
17
|
|
18
|
+
ActiveSupport::Deprecation.silenced = true
|
19
|
+
|
19
20
|
# Example has_meta_data Model:
|
20
21
|
class Article < ActiveRecord::Base
|
21
22
|
has_meta_data
|
metadata
CHANGED
@@ -1,64 +1,122 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_meta_data
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
version: 1.0.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Ben Hughes
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-04-01 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: activesupport
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70102811363480 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 7
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
- 0
|
33
|
-
- 0
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
34
21
|
version: 3.0.0
|
35
22
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: activerecord
|
39
23
|
prerelease: false
|
40
|
-
|
24
|
+
version_requirements: *70102811363480
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: activerecord
|
27
|
+
requirement: &70102811362980 !ruby/object:Gem::Requirement
|
41
28
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
hash: 7
|
46
|
-
segments:
|
47
|
-
- 3
|
48
|
-
- 0
|
49
|
-
- 0
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
50
32
|
version: 3.0.0
|
51
33
|
type: :runtime
|
52
|
-
|
53
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70102811362980
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &70102811362500 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '2.0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70102811362500
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: factory_girl
|
49
|
+
requirement: &70102811362000 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.6.2
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70102811362000
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: faker
|
60
|
+
requirement: &70102811361520 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 1.0.0
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70102811361520
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: &70102811361040 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.3.4
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70102811361040
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: appraisal
|
82
|
+
requirement: &70102811360560 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 0.4.0
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70102811360560
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rdoc
|
93
|
+
requirement: &70102811360080 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ~>
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '3.12'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70102811360080
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: rake
|
104
|
+
requirement: &70102811359660 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *70102811359660
|
113
|
+
description: Create one model backed by a primary table and a supplementary 'meta'
|
114
|
+
table.
|
54
115
|
email: ben@railsgarden.com
|
55
116
|
executables: []
|
56
|
-
|
57
117
|
extensions: []
|
58
|
-
|
59
118
|
extra_rdoc_files: []
|
60
|
-
|
61
|
-
files:
|
119
|
+
files:
|
62
120
|
- lib/has_meta_data/railtie.rb
|
63
121
|
- lib/has_meta_data/version.rb
|
64
122
|
- lib/has_meta_data.rb
|
@@ -68,46 +126,35 @@ files:
|
|
68
126
|
- spec/factories/article.rb
|
69
127
|
- spec/has_meta_data_spec.rb
|
70
128
|
- spec/spec_helper.rb
|
71
|
-
-
|
129
|
+
- Appraisals
|
130
|
+
- Gemfile
|
131
|
+
- Gemfile.lock
|
72
132
|
- LICENSE
|
73
133
|
- Rakefile
|
74
134
|
- README.rdoc
|
75
135
|
- init.rb
|
76
|
-
has_rdoc: true
|
77
136
|
homepage: http://github.com/rubiety/has_meta_data
|
78
137
|
licenses: []
|
79
|
-
|
80
138
|
post_install_message:
|
81
139
|
rdoc_options: []
|
82
|
-
|
83
|
-
require_paths:
|
140
|
+
require_paths:
|
84
141
|
- lib
|
85
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
143
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
|
92
|
-
- 0
|
93
|
-
version: "0"
|
94
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ! '>='
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
149
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
hash: 19
|
100
|
-
segments:
|
101
|
-
- 1
|
102
|
-
- 3
|
103
|
-
- 4
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
104
153
|
version: 1.3.4
|
105
154
|
requirements: []
|
106
|
-
|
107
155
|
rubyforge_project: has_meta_data
|
108
|
-
rubygems_version: 1.
|
156
|
+
rubygems_version: 1.8.10
|
109
157
|
signing_key:
|
110
158
|
specification_version: 3
|
111
159
|
summary: Extended attributes in an attached meta table.
|
112
160
|
test_files: []
|
113
|
-
|