mm-concerns 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -5
- data/Gemfile.lock +30 -0
- data/README.rdoc +5 -1
- data/VERSION +1 -1
- data/lib/mm-concerns.rb +7 -9
- data/mm-concerns.gemspec +18 -4
- metadata +93 -17
data/Gemfile
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
2
|
|
6
|
-
# Add dependencies to develop your gem here.
|
7
|
-
# Include everything needed to run rake, tests, features, etc.
|
8
3
|
group :development do
|
4
|
+
gem 'bson_ext', '1.3.0'
|
5
|
+
gem 'mongo_mapper', '0.9.0'
|
6
|
+
gem 'i18n'
|
7
|
+
|
8
|
+
gem 'ruby-debug'
|
9
9
|
gem "rspec", "~> 2.1.0"
|
10
|
+
gem "yard", "~> 0.6.0"
|
10
11
|
gem "bundler", "~> 1.0.0"
|
11
12
|
gem "jeweler", "~> 1.5.1"
|
12
13
|
gem "rcov", ">= 0"
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,31 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
activemodel (3.0.6)
|
5
|
+
activesupport (= 3.0.6)
|
6
|
+
builder (~> 2.1.2)
|
7
|
+
i18n (~> 0.5.0)
|
8
|
+
activesupport (3.0.6)
|
9
|
+
bson (1.3.0)
|
10
|
+
bson_ext (1.3.0)
|
11
|
+
builder (2.1.2)
|
12
|
+
columnize (0.3.2)
|
4
13
|
diff-lcs (1.1.2)
|
5
14
|
git (1.2.5)
|
15
|
+
i18n (0.5.0)
|
6
16
|
jeweler (1.5.1)
|
7
17
|
bundler (~> 1.0.0)
|
8
18
|
git (>= 1.2.5)
|
9
19
|
rake
|
20
|
+
linecache (0.43)
|
21
|
+
mongo (1.3.0)
|
22
|
+
bson (>= 1.3.0)
|
23
|
+
mongo_mapper (0.9.0)
|
24
|
+
activemodel (~> 3.0.0)
|
25
|
+
activesupport (~> 3.0.0)
|
26
|
+
plucky (~> 0.3.6)
|
27
|
+
plucky (0.3.7)
|
28
|
+
mongo (~> 1.1)
|
10
29
|
rake (0.8.7)
|
11
30
|
rcov (0.9.9)
|
12
31
|
rspec (2.1.0)
|
@@ -17,12 +36,23 @@ GEM
|
|
17
36
|
rspec-expectations (2.1.0)
|
18
37
|
diff-lcs (~> 1.1.2)
|
19
38
|
rspec-mocks (2.1.0)
|
39
|
+
ruby-debug (0.10.4)
|
40
|
+
columnize (>= 0.1)
|
41
|
+
ruby-debug-base (~> 0.10.4.0)
|
42
|
+
ruby-debug-base (0.10.4)
|
43
|
+
linecache (>= 0.3)
|
44
|
+
yard (0.6.7)
|
20
45
|
|
21
46
|
PLATFORMS
|
22
47
|
ruby
|
23
48
|
|
24
49
|
DEPENDENCIES
|
50
|
+
bson_ext (= 1.3.0)
|
25
51
|
bundler (~> 1.0.0)
|
52
|
+
i18n
|
26
53
|
jeweler (~> 1.5.1)
|
54
|
+
mongo_mapper (= 0.9.0)
|
27
55
|
rcov
|
28
56
|
rspec (~> 2.1.0)
|
57
|
+
ruby-debug
|
58
|
+
yard (~> 0.6.0)
|
data/README.rdoc
CHANGED
@@ -5,6 +5,9 @@ A very simple mongomapper plugin that lets you organise your models into subdire
|
|
5
5
|
this code is a modification of code I saw in in [teambox](https://github.com/teambox/teambox)
|
6
6
|
https://github.com/teambox/teambox/blob/master/config/initializers/concerns.rb
|
7
7
|
|
8
|
+
v1.1 is a mongomapper 0.9.0 update to support the new plugin system
|
9
|
+
if you are using mongomapper 0.8.x please use version 1.0.1 of the gem
|
10
|
+
|
8
11
|
|
9
12
|
== Usage
|
10
13
|
|
@@ -53,6 +56,7 @@ app/models/user/scopes.rb
|
|
53
56
|
scope :for_project, lambda { |project| where( :id => { :$in => project.user_ids } ) }
|
54
57
|
end
|
55
58
|
|
59
|
+
|
56
60
|
== Why?
|
57
61
|
|
58
62
|
I find this system of organizing my functionality make my codebase much quicker and easier to maintain.
|
@@ -84,7 +88,7 @@ I use this plugin to organize my models like so:
|
|
84
88
|
`-- validations.rb
|
85
89
|
|
86
90
|
|
87
|
-
I'
|
91
|
+
I'd be very interested to hear comments on this system, if this helps you out, or if you have a better way of organizing your code.
|
88
92
|
|
89
93
|
|
90
94
|
== Contributing to mm-concerns
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/lib/mm-concerns.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
module
|
1
|
+
module MongoMapperConcernsPlugin
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
2
4
|
module ClassMethods
|
3
5
|
def concerned_with(*concerns)
|
4
6
|
concerns.each do |concern|
|
@@ -6,18 +8,14 @@ module ConcernsPlugin
|
|
6
8
|
end
|
7
9
|
end
|
8
10
|
end
|
11
|
+
|
9
12
|
module InstanceMethods
|
10
13
|
def concerned_with(*concerns)
|
11
14
|
self.class.concerned_with(concerns)
|
12
15
|
end
|
13
16
|
end
|
17
|
+
|
14
18
|
end
|
15
19
|
|
16
|
-
|
17
|
-
|
18
|
-
model.plugin ConcernsPlugin
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
MongoMapper::Document.append_inclusions(ConcernsPluginAddition)
|
23
|
-
MongoMapper::EmbeddedDocument.append_inclusions(ConcernsPluginAddition)
|
20
|
+
MongoMapper::Document.plugin(MongoMapperConcernsPlugin)
|
21
|
+
MongoMapper::EmbeddedDocument.plugin(MongoMapperConcernsPlugin)
|
data/mm-concerns.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mm-concerns}
|
8
|
-
s.version = "1.0
|
8
|
+
s.version = "1.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Luke Cunningham"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-04-14}
|
13
13
|
s.description = %q{A very simple mongomapper plugin that lets you organise your models into subdirectories}
|
14
14
|
s.email = %q{luke@icaruswings.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.homepage = %q{http://github.com/icaruswings/mm-concerns}
|
34
34
|
s.licenses = ["MIT"]
|
35
35
|
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.
|
36
|
+
s.rubygems_version = %q{1.6.2}
|
37
37
|
s.summary = %q{A very simple mongomapper plugin that lets you organise your models into subdirectories}
|
38
38
|
s.test_files = [
|
39
39
|
"spec/mm-concerns_spec.rb",
|
@@ -41,22 +41,36 @@ Gem::Specification.new do |s|
|
|
41
41
|
]
|
42
42
|
|
43
43
|
if s.respond_to? :specification_version then
|
44
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
45
44
|
s.specification_version = 3
|
46
45
|
|
47
46
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_development_dependency(%q<bson_ext>, ["= 1.3.0"])
|
48
|
+
s.add_development_dependency(%q<mongo_mapper>, ["= 0.9.0"])
|
49
|
+
s.add_development_dependency(%q<i18n>, [">= 0"])
|
50
|
+
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
48
51
|
s.add_development_dependency(%q<rspec>, ["~> 2.1.0"])
|
52
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
49
53
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
50
54
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
51
55
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
52
56
|
else
|
57
|
+
s.add_dependency(%q<bson_ext>, ["= 1.3.0"])
|
58
|
+
s.add_dependency(%q<mongo_mapper>, ["= 0.9.0"])
|
59
|
+
s.add_dependency(%q<i18n>, [">= 0"])
|
60
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
53
61
|
s.add_dependency(%q<rspec>, ["~> 2.1.0"])
|
62
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
54
63
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
55
64
|
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
56
65
|
s.add_dependency(%q<rcov>, [">= 0"])
|
57
66
|
end
|
58
67
|
else
|
68
|
+
s.add_dependency(%q<bson_ext>, ["= 1.3.0"])
|
69
|
+
s.add_dependency(%q<mongo_mapper>, ["= 0.9.0"])
|
70
|
+
s.add_dependency(%q<i18n>, [">= 0"])
|
71
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
59
72
|
s.add_dependency(%q<rspec>, ["~> 2.1.0"])
|
73
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
60
74
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
61
75
|
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
62
76
|
s.add_dependency(%q<rcov>, [">= 0"])
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mm-concerns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Luke Cunningham
|
@@ -15,12 +15,73 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-04-14 00:00:00 +10:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
prerelease: false
|
23
|
-
|
23
|
+
type: :development
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - "="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 27
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 3
|
33
|
+
- 0
|
34
|
+
version: 1.3.0
|
35
|
+
name: bson_ext
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
prerelease: false
|
39
|
+
type: :development
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - "="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 59
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 9
|
49
|
+
- 0
|
50
|
+
version: 0.9.0
|
51
|
+
name: mongo_mapper
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
prerelease: false
|
55
|
+
type: :development
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 3
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
version: "0"
|
65
|
+
name: i18n
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
prerelease: false
|
69
|
+
type: :development
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
version: "0"
|
79
|
+
name: ruby-debug
|
80
|
+
version_requirements: *id004
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
prerelease: false
|
83
|
+
type: :development
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
24
85
|
none: false
|
25
86
|
requirements:
|
26
87
|
- - ~>
|
@@ -32,11 +93,27 @@ dependencies:
|
|
32
93
|
- 0
|
33
94
|
version: 2.1.0
|
34
95
|
name: rspec
|
35
|
-
|
96
|
+
version_requirements: *id005
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
prerelease: false
|
36
99
|
type: :development
|
100
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ~>
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
hash: 7
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
- 6
|
109
|
+
- 0
|
110
|
+
version: 0.6.0
|
111
|
+
name: yard
|
112
|
+
version_requirements: *id006
|
37
113
|
- !ruby/object:Gem::Dependency
|
38
114
|
prerelease: false
|
39
|
-
|
115
|
+
type: :development
|
116
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
40
117
|
none: false
|
41
118
|
requirements:
|
42
119
|
- - ~>
|
@@ -48,11 +125,11 @@ dependencies:
|
|
48
125
|
- 0
|
49
126
|
version: 1.0.0
|
50
127
|
name: bundler
|
51
|
-
|
52
|
-
type: :development
|
128
|
+
version_requirements: *id007
|
53
129
|
- !ruby/object:Gem::Dependency
|
54
130
|
prerelease: false
|
55
|
-
|
131
|
+
type: :development
|
132
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
56
133
|
none: false
|
57
134
|
requirements:
|
58
135
|
- - ~>
|
@@ -64,11 +141,11 @@ dependencies:
|
|
64
141
|
- 1
|
65
142
|
version: 1.5.1
|
66
143
|
name: jeweler
|
67
|
-
|
68
|
-
type: :development
|
144
|
+
version_requirements: *id008
|
69
145
|
- !ruby/object:Gem::Dependency
|
70
146
|
prerelease: false
|
71
|
-
|
147
|
+
type: :development
|
148
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
72
149
|
none: false
|
73
150
|
requirements:
|
74
151
|
- - ">="
|
@@ -78,8 +155,7 @@ dependencies:
|
|
78
155
|
- 0
|
79
156
|
version: "0"
|
80
157
|
name: rcov
|
81
|
-
|
82
|
-
type: :development
|
158
|
+
version_requirements: *id009
|
83
159
|
description: A very simple mongomapper plugin that lets you organise your models into subdirectories
|
84
160
|
email: luke@icaruswings.com
|
85
161
|
executables: []
|
@@ -132,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
208
|
requirements: []
|
133
209
|
|
134
210
|
rubyforge_project:
|
135
|
-
rubygems_version: 1.
|
211
|
+
rubygems_version: 1.6.2
|
136
212
|
signing_key:
|
137
213
|
specification_version: 3
|
138
214
|
summary: A very simple mongomapper plugin that lets you organise your models into subdirectories
|