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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb2cf5b835141d1956e52495b6e86298c7a0bd38
4
- data.tar.gz: f63d857ce9b317ae26a8272a6c31d31d8eed00cd
3
+ metadata.gz: a94ebf8444c382b344f00ddfb1931da52bf51c4b
4
+ data.tar.gz: 3791d41381e505c5bd36b79c67a57cbfdbed2b21
5
5
  SHA512:
6
- metadata.gz: 19ce8a8033d1b9f83aad57e287ec49d53f2ebffb502820ec6be488949a961cc950b1b626b04b58a9af30e739553ea625eb9268696dfbc6d69ea6db5f75b53aed
7
- data.tar.gz: 3162fe711a8e2b827657dd3e3bf2ce093ecece7c97724abbe532ba5b1eefe47bc3fca62422c7722215e449e61a2ecfb824c349e1e691062bcc36058eba8e1ffb
6
+ metadata.gz: 35ad87124fa37006e0592c14feac068101c975a16ede088640ae2bc96c7245d06f8b7ba82bd51a9af12eb9e239da6f5be815217d133f1dd27de39dc7c99ac628
7
+ data.tar.gz: 55347e9a3a093c220523797ebde42b15a77a5d2cf4b72592c1bac96207ef88f1681e359dda954ee2bb1aea5022a854ab88a05b06d68b327523e4b3c303b3c5de
@@ -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(generator_container, facet_container)
22
+ def copy_targets_to_generator_target_manager(template_set_container, facet_container)
23
23
  facet_container.target_manager.targets.each do |target|
24
- generator_container.target_manager.target(target.key, target.container_key, :access_method => target.access_method)
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{reality-facets}
5
- s.version = '1.7.0'
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.6.0'
25
- s.add_dependency 'reality-naming', '>= 1.6.0'
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'])
@@ -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.7.0
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: 2016-12-29 00:00:00.000000000 Z
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.6.0
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.6.0
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.6.0
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.6.0
40
+ version: 1.9.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: reality-orderedhash
43
43
  requirement: !ruby/object:Gem::Requirement