concerned 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -7
- data/Gemfile.lock +76 -85
- data/VERSION +1 -1
- data/concerned.gemspec +16 -15
- data/lib/concerned/module_ext.rb +1 -1
- data/spec/concerned_spec.rb +17 -0
- data/spec/fixture_user/bar.rb +6 -0
- data/spec/shared/associations.rb +5 -1
- metadata +13 -12
data/Gemfile
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
source
|
1
|
+
source 'https://www.rubygems.org'
|
2
2
|
|
3
3
|
group :test do
|
4
|
-
gem 'rails'
|
4
|
+
gem 'rails', '>= 3.0.8'
|
5
5
|
end
|
6
6
|
|
7
7
|
group :development do
|
8
|
-
gem "rspec",
|
9
|
-
gem "rdoc",
|
10
|
-
gem "bundler",
|
11
|
-
gem "jeweler",
|
12
|
-
gem "simplecov",
|
8
|
+
gem "rspec", ">= 2.8.0"
|
9
|
+
gem "rdoc", ">= 3.12"
|
10
|
+
gem "bundler", ">= 1.1.0"
|
11
|
+
gem "jeweler", ">= 1.8.3"
|
12
|
+
gem "simplecov", ">= 0.5"
|
13
13
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,109 +1,100 @@
|
|
1
1
|
GEM
|
2
|
-
remote:
|
2
|
+
remote: https://www.rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
rack
|
15
|
-
rack-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
arel (
|
32
|
-
builder (
|
33
|
-
diff-lcs (1.1
|
34
|
-
erubis (2.
|
4
|
+
abstract (1.0.0)
|
5
|
+
actionmailer (3.0.8)
|
6
|
+
actionpack (= 3.0.8)
|
7
|
+
mail (~> 2.2.19)
|
8
|
+
actionpack (3.0.8)
|
9
|
+
activemodel (= 3.0.8)
|
10
|
+
activesupport (= 3.0.8)
|
11
|
+
builder (~> 2.1.2)
|
12
|
+
erubis (~> 2.6.6)
|
13
|
+
i18n (~> 0.5.0)
|
14
|
+
rack (~> 1.2.1)
|
15
|
+
rack-mount (~> 0.6.14)
|
16
|
+
rack-test (~> 0.5.7)
|
17
|
+
tzinfo (~> 0.3.23)
|
18
|
+
activemodel (3.0.8)
|
19
|
+
activesupport (= 3.0.8)
|
20
|
+
builder (~> 2.1.2)
|
21
|
+
i18n (~> 0.5.0)
|
22
|
+
activerecord (3.0.8)
|
23
|
+
activemodel (= 3.0.8)
|
24
|
+
activesupport (= 3.0.8)
|
25
|
+
arel (~> 2.0.10)
|
26
|
+
tzinfo (~> 0.3.23)
|
27
|
+
activeresource (3.0.8)
|
28
|
+
activemodel (= 3.0.8)
|
29
|
+
activesupport (= 3.0.8)
|
30
|
+
activesupport (3.0.8)
|
31
|
+
arel (2.0.10)
|
32
|
+
builder (2.1.2)
|
33
|
+
diff-lcs (1.2.1)
|
34
|
+
erubis (2.6.6)
|
35
|
+
abstract (>= 1.0.0)
|
35
36
|
git (1.2.5)
|
36
|
-
|
37
|
-
|
38
|
-
jeweler (1.8.3)
|
37
|
+
i18n (0.5.0)
|
38
|
+
jeweler (1.8.4)
|
39
39
|
bundler (~> 1.0)
|
40
40
|
git (>= 1.2.5)
|
41
41
|
rake
|
42
42
|
rdoc
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
json (1.7.7)
|
44
|
+
mail (2.2.19)
|
45
|
+
activesupport (>= 2.3.6)
|
46
46
|
i18n (>= 0.4.0)
|
47
47
|
mime-types (~> 1.16)
|
48
48
|
treetop (~> 1.4.8)
|
49
|
-
mime-types (1.
|
50
|
-
multi_json (1.
|
49
|
+
mime-types (1.21)
|
50
|
+
multi_json (1.6.1)
|
51
51
|
polyglot (0.3.3)
|
52
|
-
rack (1.
|
53
|
-
rack-
|
54
|
-
rack (>= 0.
|
55
|
-
rack-
|
56
|
-
rack
|
57
|
-
rack-test (0.6.1)
|
52
|
+
rack (1.2.8)
|
53
|
+
rack-mount (0.6.14)
|
54
|
+
rack (>= 1.0.0)
|
55
|
+
rack-test (0.5.7)
|
58
56
|
rack (>= 1.0)
|
59
|
-
rails (3.
|
60
|
-
actionmailer (= 3.
|
61
|
-
actionpack (= 3.
|
62
|
-
activerecord (= 3.
|
63
|
-
activeresource (= 3.
|
64
|
-
activesupport (= 3.
|
57
|
+
rails (3.0.8)
|
58
|
+
actionmailer (= 3.0.8)
|
59
|
+
actionpack (= 3.0.8)
|
60
|
+
activerecord (= 3.0.8)
|
61
|
+
activeresource (= 3.0.8)
|
62
|
+
activesupport (= 3.0.8)
|
65
63
|
bundler (~> 1.0)
|
66
|
-
railties (= 3.
|
67
|
-
railties (3.
|
68
|
-
actionpack (= 3.
|
69
|
-
activesupport (= 3.
|
70
|
-
rack-ssl (~> 1.3.2)
|
64
|
+
railties (= 3.0.8)
|
65
|
+
railties (3.0.8)
|
66
|
+
actionpack (= 3.0.8)
|
67
|
+
activesupport (= 3.0.8)
|
71
68
|
rake (>= 0.8.7)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
rdoc (3.12)
|
69
|
+
thor (~> 0.14.4)
|
70
|
+
rake (10.0.3)
|
71
|
+
rdoc (4.0.0)
|
76
72
|
json (~> 1.4)
|
77
|
-
rspec (2.
|
78
|
-
rspec-core (~> 2.
|
79
|
-
rspec-expectations (~> 2.
|
80
|
-
rspec-mocks (~> 2.
|
81
|
-
rspec-core (2.
|
82
|
-
rspec-expectations (2.
|
83
|
-
diff-lcs (
|
84
|
-
rspec-mocks (2.
|
85
|
-
simplecov (0.
|
86
|
-
multi_json (~> 1.
|
87
|
-
simplecov-html (~> 0.
|
88
|
-
simplecov-html (0.
|
89
|
-
sprockets (2.1.3)
|
90
|
-
hike (~> 1.2)
|
91
|
-
rack (~> 1.0)
|
92
|
-
tilt (~> 1.1, != 1.3.0)
|
73
|
+
rspec (2.13.0)
|
74
|
+
rspec-core (~> 2.13.0)
|
75
|
+
rspec-expectations (~> 2.13.0)
|
76
|
+
rspec-mocks (~> 2.13.0)
|
77
|
+
rspec-core (2.13.0)
|
78
|
+
rspec-expectations (2.13.0)
|
79
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
80
|
+
rspec-mocks (2.13.0)
|
81
|
+
simplecov (0.7.1)
|
82
|
+
multi_json (~> 1.0)
|
83
|
+
simplecov-html (~> 0.7.1)
|
84
|
+
simplecov-html (0.7.1)
|
93
85
|
thor (0.14.6)
|
94
|
-
|
95
|
-
treetop (1.4.10)
|
86
|
+
treetop (1.4.12)
|
96
87
|
polyglot
|
97
88
|
polyglot (>= 0.3.1)
|
98
|
-
tzinfo (0.3.
|
89
|
+
tzinfo (0.3.35)
|
99
90
|
|
100
91
|
PLATFORMS
|
101
92
|
ruby
|
102
93
|
|
103
94
|
DEPENDENCIES
|
104
|
-
bundler (
|
105
|
-
jeweler (
|
106
|
-
rails
|
107
|
-
rdoc (
|
108
|
-
rspec (
|
95
|
+
bundler (>= 1.1.0)
|
96
|
+
jeweler (>= 1.8.3)
|
97
|
+
rails (>= 3.0.8)
|
98
|
+
rdoc (>= 3.12)
|
99
|
+
rspec (>= 2.8.0)
|
109
100
|
simplecov (>= 0.5)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/concerned.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "concerned"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-03-02"
|
13
13
|
s.description = "Makes it easy to apply the concerns pattern in any Ruby context"
|
14
14
|
s.email = "kmandrup@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
"lib/concerned.rb",
|
30
30
|
"lib/concerned/module_ext.rb",
|
31
31
|
"spec/concerned_spec.rb",
|
32
|
+
"spec/fixture_user/bar.rb",
|
32
33
|
"spec/fixture_user/foo.rb",
|
33
34
|
"spec/fixture_user/scopes.rb",
|
34
35
|
"spec/fixture_user/validations.rb",
|
@@ -41,30 +42,30 @@ Gem::Specification.new do |s|
|
|
41
42
|
s.homepage = "http://github.com/kristianmandrup/concerned"
|
42
43
|
s.licenses = ["MIT"]
|
43
44
|
s.require_paths = ["lib"]
|
44
|
-
s.rubygems_version = "1.8.
|
45
|
+
s.rubygems_version = "1.8.25"
|
45
46
|
s.summary = "Concerns for Ruby (and Rails) projects"
|
46
47
|
|
47
48
|
if s.respond_to? :specification_version then
|
48
49
|
s.specification_version = 3
|
49
50
|
|
50
51
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
51
|
-
s.add_development_dependency(%q<rspec>, ["
|
52
|
-
s.add_development_dependency(%q<rdoc>, ["
|
53
|
-
s.add_development_dependency(%q<bundler>, ["
|
54
|
-
s.add_development_dependency(%q<jeweler>, ["
|
52
|
+
s.add_development_dependency(%q<rspec>, [">= 2.8.0"])
|
53
|
+
s.add_development_dependency(%q<rdoc>, [">= 3.12"])
|
54
|
+
s.add_development_dependency(%q<bundler>, [">= 1.1.0"])
|
55
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.8.3"])
|
55
56
|
s.add_development_dependency(%q<simplecov>, [">= 0.5"])
|
56
57
|
else
|
57
|
-
s.add_dependency(%q<rspec>, ["
|
58
|
-
s.add_dependency(%q<rdoc>, ["
|
59
|
-
s.add_dependency(%q<bundler>, ["
|
60
|
-
s.add_dependency(%q<jeweler>, ["
|
58
|
+
s.add_dependency(%q<rspec>, [">= 2.8.0"])
|
59
|
+
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
60
|
+
s.add_dependency(%q<bundler>, [">= 1.1.0"])
|
61
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.3"])
|
61
62
|
s.add_dependency(%q<simplecov>, [">= 0.5"])
|
62
63
|
end
|
63
64
|
else
|
64
|
-
s.add_dependency(%q<rspec>, ["
|
65
|
-
s.add_dependency(%q<rdoc>, ["
|
66
|
-
s.add_dependency(%q<bundler>, ["
|
67
|
-
s.add_dependency(%q<jeweler>, ["
|
65
|
+
s.add_dependency(%q<rspec>, [">= 2.8.0"])
|
66
|
+
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
67
|
+
s.add_dependency(%q<bundler>, [">= 1.1.0"])
|
68
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.3"])
|
68
69
|
s.add_dependency(%q<simplecov>, [">= 0.5"])
|
69
70
|
end
|
70
71
|
end
|
data/lib/concerned/module_ext.rb
CHANGED
@@ -17,7 +17,7 @@ class Module
|
|
17
17
|
|
18
18
|
def include_concerns(*concerns)
|
19
19
|
options = concerns.extract_options!
|
20
|
-
scope_name = options[:for]
|
20
|
+
scope_name = options[:for] || options[:from] || name
|
21
21
|
concerns.flatten.each do |concern|
|
22
22
|
next if concern.blank?
|
23
23
|
require_concern scope_name, concern
|
data/spec/concerned_spec.rb
CHANGED
@@ -26,12 +26,29 @@ class FixtureUserFor
|
|
26
26
|
include_concerns :foo, for: 'fixture_user'
|
27
27
|
end
|
28
28
|
|
29
|
+
class FixtureUserFrom
|
30
|
+
include_concerns :bar, from: 'fixture_user'
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
describe 'shared concerns' do
|
35
|
+
it 'should require it' do
|
36
|
+
expect(Assoc.abc).to be true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
29
40
|
describe "Concerned" do
|
30
41
|
describe "using :for" do
|
31
42
|
it 'should include Foo module' do
|
32
43
|
FixtureUserFor.new.should respond_to(:foo)
|
33
44
|
end
|
34
45
|
end
|
46
|
+
|
47
|
+
describe "using :from" do
|
48
|
+
it 'should include Foo module' do
|
49
|
+
FixtureUserFrom.new.should respond_to(:bar)
|
50
|
+
end
|
51
|
+
end
|
35
52
|
end
|
36
53
|
|
37
54
|
describe "Concerned" do
|
data/spec/shared/associations.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concerned
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,14 +9,14 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 2.8.0
|
22
22
|
type: :development
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 2.8.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '3.12'
|
38
38
|
type: :development
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '3.12'
|
46
46
|
- !ruby/object:Gem::Dependency
|
@@ -48,7 +48,7 @@ dependencies:
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 1.1.0
|
54
54
|
type: :development
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.1.0
|
62
62
|
- !ruby/object:Gem::Dependency
|
@@ -64,7 +64,7 @@ dependencies:
|
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 1.8.3
|
70
70
|
type: :development
|
@@ -72,7 +72,7 @@ dependencies:
|
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: 1.8.3
|
78
78
|
- !ruby/object:Gem::Dependency
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/concerned.rb
|
112
112
|
- lib/concerned/module_ext.rb
|
113
113
|
- spec/concerned_spec.rb
|
114
|
+
- spec/fixture_user/bar.rb
|
114
115
|
- spec/fixture_user/foo.rb
|
115
116
|
- spec/fixture_user/scopes.rb
|
116
117
|
- spec/fixture_user/validations.rb
|
@@ -134,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
135
|
version: '0'
|
135
136
|
segments:
|
136
137
|
- 0
|
137
|
-
hash:
|
138
|
+
hash: 916306081316537692
|
138
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
140
|
none: false
|
140
141
|
requirements:
|
@@ -143,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
144
|
version: '0'
|
144
145
|
requirements: []
|
145
146
|
rubyforge_project:
|
146
|
-
rubygems_version: 1.8.
|
147
|
+
rubygems_version: 1.8.25
|
147
148
|
signing_key:
|
148
149
|
specification_version: 3
|
149
150
|
summary: Concerns for Ruby (and Rails) projects
|