tdc 0.3.8 → 0.3.9

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
  SHA256:
3
- metadata.gz: 2887adedbcb323e7d03e75b65538c2afc1edbe5f4ea84c0555e50dda77bc1305
4
- data.tar.gz: a8be475b6e7edcd72ab2047cab59a198e984b921d4893ca5bac25ef0476540ea
3
+ metadata.gz: 40158a1118d92cb453c0197da1eea7850c19ba2bba98306806bf920f167d16b8
4
+ data.tar.gz: '09f31030294fadabb38f88c6976d56774670b636ec43bb2ae4d62a96ad234087'
5
5
  SHA512:
6
- metadata.gz: f1aaaf060b8e5b85ab96487279471521b9a04738a63cf360473905a6834d08bfc3bd3ddef01c5b2e571736b87177b74a21ee5cba24860e56bcdb206e208e3962
7
- data.tar.gz: dc9cd3002213b1b5c2f6d95f09b986249c30fe239a28e788f06462d00f496b02a3cbc707d5236bd987d44ea435e9b516adbb777f480cce24a0ca22a06b59fe52
6
+ metadata.gz: 40758219403185741dbc04f645f5f7d19a07ff004514cf5c5d9c7a4312085d4918d8d2694204c643bcb97f808c8c958b002b7c2e684748d8d1621e1b9f49f182
7
+ data.tar.gz: 41777ff45589fc3de09026e86e0e26220cd863a95861fd866a337f53b23ec0211f4d4ced7d0feac6cabbf563175f6b6234888b441c80d30bd848bad2f42cef16
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.9] - 2020-08-12
10
+
11
+ #### Breaking Changes
12
+
13
+ - Collapse `ConfigurableGenerator` into `StandardGenerator`
14
+
9
15
  ## [0.3.8] - 2020-08-11
10
16
 
11
17
  #### New Features
Binary file
data/lib/tdc.rb CHANGED
@@ -39,7 +39,6 @@ require "tdc/generators/definition_sourcable"
39
39
 
40
40
  # Generator Hierarchy
41
41
  require "tdc/generators/generator_base"
42
- require "tdc/generators/configurable_generator"
43
42
  require "tdc/generators/standard_generator"
44
43
 
45
44
  #
@@ -1,11 +1,15 @@
1
1
  module Tdc
2
2
  module Generators
3
3
  #
4
- # Abstract class for defining generators that define a collection of model instances.
4
+ # Knows how to provide a configurable instance definition.
5
5
  #
6
- # See also SingularGenerator.
7
- #
8
- class StandardGenerator < Tdc::Generators::ConfigurableGenerator
6
+ class StandardGenerator < Tdc::Generators::GeneratorBase
7
+ include Tdc::Generators::DefinitionSourcable
8
+
9
+ attr_reader :instance_definition
10
+
11
+ source_definition_from :instance_definition
12
+
9
13
  def generate
10
14
  CatalogEntries.new.tap do |catalog_entries|
11
15
  instance_definitions.each do |instance_definition|
@@ -21,6 +25,43 @@ module Tdc
21
25
  end
22
26
  end
23
27
  end
28
+
29
+ def run_resolvers_and_generate_instance
30
+ run_extended_attribute_interpreters(instance_definition)
31
+ run_definition_resolvers(instance_definition)
32
+
33
+ generate_instance
34
+ end
35
+
36
+ #
37
+ # Hook method: subclasses are expected to define how to generate a model instance.
38
+ #
39
+ def generate_instance
40
+ raise Tdc::MissingOverrideError, "Implement the 'generate_instance' method"
41
+ end
42
+
43
+ #
44
+ # Hook method: subclasses may include the DefinitionResolvable concern to override.
45
+ #
46
+ def run_definition_resolvers(_instance_definition)
47
+ # Do nothing
48
+ end
49
+
50
+ private
51
+
52
+ def configure_instance_definition(instance_definition)
53
+ @instance_definition = instance_definition
54
+
55
+ configure_definition_source(instance_definition)
56
+ end
57
+
58
+ def run_extended_attribute_interpreters(instance_definition)
59
+ interpreters.each { |interpreter| interpreter.interpret(instance_definition) }
60
+ end
61
+
62
+ def interpreters
63
+ Tdc::ExtendedAttributes::InterpreterRegistry.instance.interpreters
64
+ end
24
65
  end
25
66
  end
26
67
  end
@@ -1,3 +1,3 @@
1
1
  module Tdc
2
- VERSION = "0.3.8"
2
+ VERSION = "0.3.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alistair McKinnell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-11 00:00:00.000000000 Z
11
+ date: 2020-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -138,7 +138,6 @@ files:
138
138
  - lib/tdc/fatal_error.rb
139
139
  - lib/tdc/generators.rb
140
140
  - lib/tdc/generators/catalog_entries.rb
141
- - lib/tdc/generators/configurable_generator.rb
142
141
  - lib/tdc/generators/definition_resolvable.rb
143
142
  - lib/tdc/generators/definition_sourcable.rb
144
143
  - lib/tdc/generators/generation_context.rb
@@ -1,51 +0,0 @@
1
- module Tdc
2
- module Generators
3
- #
4
- # Knows how to provide a configurable instance definition.
5
- #
6
- class ConfigurableGenerator < Tdc::Generators::GeneratorBase
7
- include Tdc::Generators::DefinitionSourcable
8
-
9
- attr_reader :instance_definition
10
-
11
- source_definition_from :instance_definition
12
-
13
- def run_resolvers_and_generate_instance
14
- run_extended_attribute_interpreters(instance_definition)
15
- run_definition_resolvers(instance_definition)
16
-
17
- generate_instance
18
- end
19
-
20
- #
21
- # Hook method: subclasses are expected to define how to generate a model instance.
22
- #
23
- def generate_instance
24
- raise Tdc::MissingOverrideError, "Implement the 'generate_instance' method"
25
- end
26
-
27
- #
28
- # Hook method: subclasses may include the DefinitionResolvable concern to override.
29
- #
30
- def run_definition_resolvers(_instance_definition)
31
- # Do nothing
32
- end
33
-
34
- private
35
-
36
- def configure_instance_definition(instance_definition)
37
- @instance_definition = instance_definition
38
-
39
- configure_definition_source(instance_definition)
40
- end
41
-
42
- def run_extended_attribute_interpreters(instance_definition)
43
- interpreters.each { |interpreter| interpreter.interpret(instance_definition) }
44
- end
45
-
46
- def interpreters
47
- Tdc::ExtendedAttributes::InterpreterRegistry.instance.interpreters
48
- end
49
- end
50
- end
51
- end