reality-facets 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reality/facets/facet.rb +1 -1
- data/lib/reality/facets/generators_integration.rb +2 -2
- data/reality-facets.gemspec +3 -3
- data/test/facets/test_facet.rb +36 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a94ebf8444c382b344f00ddfb1931da52bf51c4b
|
4
|
+
data.tar.gz: 3791d41381e505c5bd36b79c67a57cbfdbed2b21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35ad87124fa37006e0592c14feac068101c975a16ede088640ae2bc96c7245d06f8b7ba82bd51a9af12eb9e239da6f5be815217d133f1dd27de39dc7c99ac628
|
7
|
+
data.tar.gz: 55347e9a3a093c220523797ebde42b15a77a5d2cf4b72592c1bac96207ef88f1681e359dda954ee2bb1aea5022a854ab88a05b06d68b327523e4b3c303b3c5de
|
data/lib/reality/facets/facet.rb
CHANGED
@@ -65,7 +65,7 @@ module Reality #nodoc
|
|
65
65
|
extension_name = "#{::Reality::Naming.pascal_case(self.key)}#{model_class.name.gsub(/^.*\:\:([^\:]+)/, '\1')}Facet"
|
66
66
|
definitions = target_manager.container.facet_definitions
|
67
67
|
definitions.class_eval(<<-RUBY)
|
68
|
-
class #{extension_name} < Reality.base_element(:container_key => :#{target.inverse_access_method})
|
68
|
+
class #{extension_name} < Reality.base_element(:container_key => :#{target.inverse_access_method}, :pre_config_code => 'pre_init if respond_to?(:pre_init)', :post_config_code => 'post_init if respond_to?(:post_init)')
|
69
69
|
def facet_key
|
70
70
|
:#{self.key}
|
71
71
|
end
|
@@ -19,9 +19,9 @@ module Reality #nodoc
|
|
19
19
|
# Copy the targets from the specified generator container to the facet container.
|
20
20
|
# This is typically used when projects include both reality-generators and reality-facets
|
21
21
|
# and do not want to duplicate the code tor defining targets in both systems
|
22
|
-
def copy_targets_to_generator_target_manager(
|
22
|
+
def copy_targets_to_generator_target_manager(template_set_container, facet_container)
|
23
23
|
facet_container.target_manager.targets.each do |target|
|
24
|
-
|
24
|
+
template_set_container.target_manager.target(target.key, target.container_key, :access_method => target.access_method)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/reality-facets.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{reality-facets}
|
5
|
-
s.version = '1.
|
5
|
+
s.version = '1.8.0'
|
6
6
|
s.platform = Gem::Platform::RUBY
|
7
7
|
|
8
8
|
s.authors = ['Peter Donald']
|
@@ -21,8 +21,8 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.has_rdoc = false
|
22
22
|
s.rdoc_options = %w(--line-numbers --inline-source --title reality-facets)
|
23
23
|
|
24
|
-
s.add_dependency 'reality-core', '>= 1.
|
25
|
-
s.add_dependency 'reality-naming', '>= 1.
|
24
|
+
s.add_dependency 'reality-core', '>= 1.8.0'
|
25
|
+
s.add_dependency 'reality-naming', '>= 1.9.0'
|
26
26
|
s.add_dependency 'reality-orderedhash', '>= 1.0.0'
|
27
27
|
|
28
28
|
s.add_development_dependency(%q<minitest>, ['= 5.9.1'])
|
data/test/facets/test_facet.rb
CHANGED
@@ -19,7 +19,6 @@ class Reality::Facets::TestFacet < Reality::TestCase
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_basic_operation
|
22
|
-
|
23
22
|
assert_equal false, TestFacetContainer.facet_by_name?(:gwt)
|
24
23
|
assert_equal false, TestFacetContainer.facet_by_name?(:gwt_rpc)
|
25
24
|
assert_equal false, TestFacetContainer.facet_by_name?(:imit)
|
@@ -158,4 +157,40 @@ class Reality::Facets::TestFacet < Reality::TestCase
|
|
158
157
|
assert_equal 'X', project.gwt.class.blah
|
159
158
|
assert_equal false, component.respond_to?(:gwt)
|
160
159
|
end
|
160
|
+
|
161
|
+
class Project3 < Reality.base_element(:name => true, :pre_config_code => 'Reality::TestCase::TestFacetContainer.target_manager.apply_extension(self)')
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_pre_and_post_init_hooks
|
165
|
+
assert_equal false, TestFacetContainer.facet_by_name?(:gwt)
|
166
|
+
|
167
|
+
TestFacetContainer.target_manager.target(Project3, :project)
|
168
|
+
|
169
|
+
facet_gwt = Reality::Facets::Facet.new(TestFacetContainer, :gwt) do |f|
|
170
|
+
f.enhance(Project3) do
|
171
|
+
|
172
|
+
attr_accessor :pre_init_ran
|
173
|
+
attr_accessor :post_init_ran
|
174
|
+
|
175
|
+
def pre_init
|
176
|
+
self.pre_init_ran = 'yep'
|
177
|
+
end
|
178
|
+
|
179
|
+
def post_init
|
180
|
+
self.post_init_ran = 'sure did'
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
assert_equal true, TestFacetContainer.facet_by_name?(:gwt)
|
186
|
+
assert_equal true, facet_gwt.enhanced?(Project3)
|
187
|
+
|
188
|
+
project = Project3.new(:MyProject) do |p|
|
189
|
+
p.enable_facets(:gwt)
|
190
|
+
end
|
191
|
+
|
192
|
+
assert_equal true, project.gwt?
|
193
|
+
assert_equal 'yep', project.gwt.pre_init_ran
|
194
|
+
assert_equal 'sure did', project.gwt.post_init_ran
|
195
|
+
end
|
161
196
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reality-facets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Donald
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: reality-core
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.8.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.8.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: reality-naming
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.9.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.9.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: reality-orderedhash
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|