ductwork 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 006fe9321eda6c5c92de6e1f7e1b508cb11d71a1e7cbef346ffa79cc8f2a94ab
4
- data.tar.gz: 3085cb1ad7002953b7e5808a7186e8faf069c0b509421bf05f2aac8b47d453d8
3
+ metadata.gz: '08a25902c240e59967cbd79257cfaa9f7aabfc9418ac6324864c2264b0be0f4f'
4
+ data.tar.gz: 33e7eee080dfbc1e993ccf60388694e560eaa95c01d6c57797775351a4063686
5
5
  SHA512:
6
- metadata.gz: 74678bcc5583a767e5bf3edcd5f5dacabe524dd17292de4535da0e94eedef35783648a00ee35fdace4d45ba7a6a3d43da45af362d8a9237d13ab002066cc8082
7
- data.tar.gz: b93a2df98327ed6a9bb7536cf4f2f07faad27107ccfc63bc5a1d243eb2b8fbc2e513c72512af14f028df698ae790ebf8102e1cca8c12e1b9090ff3f670a62b03
6
+ metadata.gz: 992ef0a0f5e6c971a3789d0ce3ea8da7753f32f354967dd788024393b6458d3b01089dbdd4a301478b59b316a7bd950bba205371ff431db35944e61920d739bf
7
+ data.tar.gz: 4fd645e68b7b66d3e5186418e3e2f18faceba41b05e700a3e7fd6a0d499abca32c3f021e95720f6350b78520bb5668df7f5e2d4bbb8b343e93cd8a84d4292af5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Ductwork Changelog
2
2
 
3
+ ## [0.17.0]
4
+
5
+ - feat: assign step node names unique hex values in the pipeline definition
6
+ - chore: remove unnecessary logging
7
+
3
8
  ## [0.16.0]
4
9
 
5
10
  - feat!: allow `Pipeline.trigger` to accept arbitrary positional arguments - this is a BREAKING CHANGE as it changes the structure of how arguments are stored and passed between steps
data/COMM-LICENSE.txt ADDED
@@ -0,0 +1,321 @@
1
+ END-USER LICENSE AGREEMENT
2
+
3
+ -------------------------------------------------------------------------------
4
+
5
+ IMPORTANT: THIS SOFTWARE END-USER LICENSE AGREEMENT ("EULA") IS A LEGAL
6
+ AGREEMENT ("Agreement") BETWEEN YOU (THE CUSTOMER, EITHER AS AN INDIVIDUAL
7
+ OR, IF PURCHASED OR OTHERWISE ACQUIRED BY OR FOR AN ENTITY, AS AN ENTITY)
8
+ AND PEN AND PAPER SOLUTIONS LLC ("Licensor"). READ IT CAREFULLY BEFORE
9
+ COMPLETING THE INSTALLATION PROCESS AND USING DUCTWORK PRO AND RELATED SOFTWARE
10
+ COMPONENTS ("Software"). IT PROVIDES A LICENSE TO USE THE SOFTWARE AND CONTAINS
11
+ WARRANTY INFORMATION AND LIABILITY DISCLAIMERS. BY INSTALLING AND USING THE
12
+ SOFTWARE, YOU ARE CONFIRMING YOUR ACCEPTANCE OF THE SOFTWARE AND AGREEING TO
13
+ BECOME BOUND BY THE TERMS OF THIS AGREEMENT.
14
+
15
+ -------------------------------------------------------------------------------
16
+
17
+ In order to use the Software under this Agreement, you must receive a "Source
18
+ URL" at the time of purchase, in accordance with the scope of use and other
19
+ terms specified for each type of Software and as set forth in this Section 1
20
+ of this Agreement.
21
+
22
+
23
+ 1. License Grant
24
+
25
+ 1.1 General Use. This Agreement grants you a non-exclusive, non-transferable,
26
+ limited license to the use rights for the Software, without the right to grant
27
+ sublicenses, subject to the terms and conditions in this Agreement. The
28
+ Software is licensed, not sold.
29
+
30
+ 1.2 Pro License. If you purchased a Ductwork Pro License, you may install the
31
+ Software on an unlimited number of Hosts. "Host" means any physical or virtual
32
+ machine which is controlled by you. You may run an unlimited number of Workers.
33
+ "Worker" means a thread or process which executes Pipeline Steps. You may
34
+ concurrently run the Software on an unlimited number of Hosts, with each Host
35
+ running an unlimited number of Workers.
36
+
37
+ 1.3 Archive Copies. You are entitled to make a reasonable amount of copies of
38
+ the Software for archival purposes. Each copy must reproduce all copyright and
39
+ other proprietary rights notices on or in the Software Product.
40
+
41
+ 1.4 Electronic Delivery. All Software and license documentation shall be
42
+ delivered by electronic means unless otherwise specified on the applicable
43
+ invoice or at the time of purchase. Software shall be deemed delivered when it
44
+ is made available for download by you ("Delivery").
45
+
46
+
47
+ 2. Modifications
48
+
49
+ Licensor shall provide you with source code so that you can create
50
+ Modifications of the original Software. "Modification" means: (a) any addition
51
+ to or deletion from the contents of a file included in the original Software or
52
+ previous Modifications created by you, or (b) any new file that contains any
53
+ part of the original Software or previous Modifications. While you retain all
54
+ rights to any original work authored by you as part of the Modifications,
55
+ Licensor continues to own all copyright and other intellectual property rights
56
+ in the Software.
57
+
58
+
59
+ 3. Restricted Uses
60
+
61
+ 3.1 You shall not (and shall not allow any third party to):
62
+
63
+ (a) decompile, disassemble, or otherwise reverse engineer the Software or
64
+ attempt to reconstruct or discover any source code, underlying ideas,
65
+ algorithms, file formats or programming interfaces of the Software by any means
66
+ whatsoever (except and only to the extent that applicable law prohibits or
67
+ restricts reverse engineering restrictions);
68
+
69
+ (b) distribute, sell, sublicense, rent, lease or use the Software for time
70
+ sharing, hosting, service provider or like purposes, except as expressly
71
+ permitted under this Agreement;
72
+
73
+ (c) redistribute the Software or Modifications other than by including the
74
+ Software or a portion thereof within your own product, which must have
75
+ substantially different functionality than the Software or Modifications and
76
+ must not allow any third party to use the Software or Modifications, or any
77
+ portions thereof, for software development or application development purposes;
78
+
79
+ (d) redistribute the Software as part of a product, "appliance" or "virtual
80
+ server";
81
+
82
+ (e) redistribute the Software on any server which is not directly under your
83
+ control;
84
+
85
+ (f) remove any product identification, proprietary, copyright or other notices
86
+ contained in the Software;
87
+
88
+ (g) modify any part of the Software, create a derivative work of any part of
89
+ the Software (except as permitted in Section 2), or incorporate the Software,
90
+ except to the extent expressly authorized in writing by Licensor;
91
+
92
+ (h) publicly disseminate performance information or analysis (including,
93
+ without limitation, benchmarks) from any source relating to the Software;
94
+
95
+ (i) utilize any equipment, device, software, or other means designed to
96
+ circumvent or remove any form of Source URL or copy protection used by Licensor
97
+ in connection with the Software, or use the Software together with any
98
+ authorization code, Source URL, serial number, or other copy protection device
99
+ not supplied by Licensor;
100
+
101
+ (j) use the Software to develop a product which is competitive with any
102
+ Licensor product offerings; or
103
+
104
+ (k) use unauthorized Source URLs or keycode(s) or distribute or publish Source
105
+ URLs or keycode(s), except as may be expressly permitted by Licensor in
106
+ writing.
107
+
108
+ If your unique Source URL is ever published, Licensor reserves the right to
109
+ terminate your access without notice.
110
+
111
+ 3.2 UNDER NO CIRCUMSTANCES MAY YOU USE THE SOFTWARE AS PART OF A PRODUCT OR
112
+ SERVICE THAT PROVIDES SIMILAR FUNCTIONALITY TO THE SOFTWARE ITSELF.
113
+
114
+ The Open Source version of the Software ("LGPL Version") is licensed under the
115
+ terms of the GNU Lesser General Public License version 3.0 ("LGPL") and not
116
+ under this EULA.
117
+
118
+
119
+ 4. Ownership
120
+
121
+ Notwithstanding anything to the contrary contained herein, except for the
122
+ limited license rights expressly provided herein, Licensor and its suppliers
123
+ have and will retain all rights, title and interest (including, without
124
+ limitation, all patent, copyright, trademark, trade secret and other
125
+ intellectual property rights) in and to the Software and all copies,
126
+ modifications and derivative works thereof (including any changes which
127
+ incorporate any of your ideas, feedback or suggestions). You acknowledge that
128
+ you are obtaining only a limited license right to the Software, and that
129
+ irrespective of any use of the words "purchase", "sale" or like terms hereunder
130
+ no ownership rights are being conveyed to you under this Agreement or otherwise.
131
+
132
+
133
+ 5. Fees and Payment
134
+
135
+ The Software license fees will be due and payable in full as set forth in the
136
+ applicable invoice or at the time of purchase. A two (2) week trial period may
137
+ be available for evaluation purposes prior to purchase; trial terms shall be
138
+ specified at the time the trial is initiated. You shall be responsible for all
139
+ taxes, withholdings, duties and levies arising from the order (excluding taxes
140
+ based on the net income of Licensor).
141
+
142
+
143
+ 6. Support, Maintenance and Services
144
+
145
+ Subject to the terms and conditions of this Agreement, as set forth in your
146
+ invoice, and as set forth on the Ductwork Pro support page
147
+ (https://docs.getductwork.io/pro/support.html), support and maintenance services
148
+ may be included with the purchase of your license subscription.
149
+
150
+
151
+ 7. Term of Agreement
152
+
153
+ 7.1 Term. This Agreement is effective as of the Delivery of the Software and
154
+ expires at such time as all license and service subscriptions hereunder have
155
+ expired in accordance with their own terms (the "Term"). For clarification, the
156
+ term of your license under this Agreement may be perpetual, limited for
157
+ Evaluation Version, or designated as a fixed-term license in the Invoice, and
158
+ shall be specified at your time of purchase. Either party may terminate this
159
+ Agreement (including all related Invoices) if the other party: (a) fails to
160
+ cure any material breach of this Agreement within thirty (30) days after
161
+ written notice of such breach, provided that Licensor may terminate this
162
+ Agreement immediately upon any breach of Section 3 or if you exceed any other
163
+ restrictions contained in Section 1, unless otherwise specified in this
164
+ Agreement; (b) ceases operation without a successor; or (c) seeks protection
165
+ under any bankruptcy, receivership, trust deed, creditors arrangement,
166
+ composition or comparable proceeding, or if any such proceeding is instituted
167
+ against such party (and not dismissed within sixty (60) days). Termination is
168
+ not an exclusive remedy and the exercise by either party of any remedy under
169
+ this Agreement will be without prejudice to any other remedies it may have
170
+ under this Agreement, by law, or otherwise.
171
+
172
+ 7.2 Termination. Upon any termination of this Agreement, you shall cease any
173
+ and all use of any Software and destroy all copies thereof.
174
+
175
+ 7.3 Expiration of License. Upon the expiration of any term under this
176
+ Agreement, (a) all Software updates and services pursuant to the license shall
177
+ cease, (b) you may only continue to run existing installations of the Software,
178
+ (c) you may not install the Software on any additional Hosts, and (d) any new
179
+ installation of the Software shall require the purchase of a new license
180
+ subscription from Licensor.
181
+
182
+
183
+ 8. Disclaimer of Warranties
184
+
185
+ The Software is provided "as is," with all faults, defects and errors, and
186
+ without warranty of any kind. Licensor does not warrant that the Software will
187
+ be free of bugs, errors, viruses or other defects, and Licensor shall have no
188
+ liability of any kind for the use of or inability to use the Software, the
189
+ Software content or any associated service, and you acknowledge that it is not
190
+ technically practicable for Licensor to do so.
191
+
192
+ To the maximum extent permitted by applicable law, Licensor disclaims all
193
+ warranties, express, implied, arising by law or otherwise, regarding the
194
+ Software, the Software content and their respective performance or suitability
195
+ for your intended use, including without limitation any implied warranty of
196
+ merchantability, fitness for a particular purpose.
197
+
198
+
199
+ 9. Limitation of Liability
200
+
201
+ In no event will Licensor be liable for any direct, indirect, consequential,
202
+ incidental, special, exemplary, or punitive damages or liabilities whatsoever
203
+ arising from or relating to the Software, the Software content or this
204
+ Agreement, whether based on contract, tort (including negligence), strict
205
+ liability or other theory, even if Licensor has been advised of the possibility
206
+ of such damages.
207
+
208
+ In no event will Licensor's liability exceed the Software license price as
209
+ indicated in the invoice. The existence of more than one claim will not enlarge
210
+ or extend this limit.
211
+
212
+
213
+ 10. Remedies
214
+
215
+ Your exclusive remedy and Licensor's entire liability for breach of this
216
+ Agreement shall be limited, at Licensor's sole and exclusive discretion, to
217
+ (a) replacement of any defective software or documentation; or (b) refund of
218
+ the license fee paid to Licensor, payable in accordance with Licensor's refund
219
+ policy.
220
+
221
+
222
+ 11. Acknowledgements
223
+
224
+ 11.1 Consent to the Use of Data. You agree that Licensor and its affiliates may
225
+ collect and use technical information gathered as part of the product support
226
+ services. Licensor may use this information solely to improve products and
227
+ services and will not disclose this information in a form that personally
228
+ identifies you.
229
+
230
+ 11.2 Verification. We or a certified auditor acting on our behalf, may, upon
231
+ its reasonable request and at its expense, audit you with respect to the use of
232
+ the Software. Such audit may be conducted by mail, electronic means or through
233
+ an in-person visit to your place of business. Any such in-person audit shall be
234
+ conducted during regular business hours at your facilities and shall not
235
+ unreasonably interfere with your business activities. We shall not remove,
236
+ copy, or redistribute any electronic material during the course of an audit. If
237
+ an audit reveals that you are using the Software in a way that is in material
238
+ violation of the terms of the EULA, then you shall pay our reasonable costs of
239
+ conducting the audit. In the case of a material violation, you agree to pay us
240
+ any amounts owing that are attributable to the unauthorized use. In the
241
+ alternative, we reserve the right, at our sole option, to terminate the
242
+ licenses for the Software.
243
+
244
+ 11.3 Government End Users. If the Software and related documentation are
245
+ supplied to or purchased by or on behalf of the United States Government, then
246
+ the Software is deemed to be "commercial software" as that term is used in the
247
+ Federal Acquisition Regulation system. Rights of the United States shall not
248
+ exceed the minimum rights set forth in FAR 52.227-19 for "restricted computer
249
+ software". All other terms and conditions of this Agreement apply.
250
+
251
+
252
+ 12. Third Party Software
253
+
254
+ Examples included in Software may provide links to third party libraries or
255
+ code (collectively "Third Party Software") to implement various functions.
256
+ Third Party Software does not comprise part of the Software. In some cases,
257
+ access to Third Party Software may be included along with the Software delivery
258
+ as a convenience for demonstration purposes. Such source code and libraries may
259
+ be included in the ".../examples" source tree delivered with the Software and
260
+ do not comprise the Software. Licensee acknowledges (1) that some part of Third
261
+ Party Software may require additional licensing of copyright and patents from
262
+ the owners of such, and (2) that distribution of any of the Software
263
+ referencing or including any portion of a Third Party Software may require
264
+ appropriate licensing from such third parties.
265
+
266
+
267
+ 13. Miscellaneous
268
+
269
+ 13.1 Entire Agreement. This Agreement sets forth our entire agreement with
270
+ respect to the Software and the subject matter hereof and supersedes all prior
271
+ and contemporaneous understandings and agreements whether written or oral.
272
+
273
+ 13.2 Amendment. Licensor reserves the right, in its sole discretion, to amend
274
+ this Agreement from time to time. Amendments to this Agreement can be located
275
+ at: https://github.com/ductwork/ductwork/blob/main/COMM-LICENSE.txt
276
+
277
+ 13.3 Assignment. You may not assign this Agreement or any of its rights under
278
+ this Agreement without the prior written consent of Licensor and any attempted
279
+ assignment without such consent shall be void.
280
+
281
+ 13.4 Export Compliance. You agree to comply with all applicable laws and
282
+ regulations, including laws, regulations, orders or other restrictions on
283
+ export, re-export or redistribution of software.
284
+
285
+ 13.5 Indemnification. You agree to defend, indemnify, and hold harmless
286
+ Licensor from and against any lawsuits, claims, losses, damages, fines and
287
+ expenses (including attorneys' fees and costs) arising out of your use of the
288
+ Software or breach of this Agreement.
289
+
290
+ 13.6 Governing Law. This Agreement is governed by the laws of the State of
291
+ Illinois and the United States without regard to conflicts of laws provisions
292
+ thereof, and without regard to the United Nations Convention on the
293
+ International Sale of Goods or the Uniform Computer Information Transactions
294
+ Act, as currently enacted by any jurisdiction or as may be codified or amended
295
+ from time to time by any jurisdiction. The jurisdiction and venue for actions
296
+ related to the subject matter hereof shall be the state of Illinois and United
297
+ States federal courts located in Chicago, Illinois, and both parties hereby
298
+ submit to the personal jurisdiction of such courts.
299
+
300
+ 13.7 Attorneys' Fees and Costs. The prevailing party in any action to enforce
301
+ this Agreement will be entitled to recover its attorneys' fees and costs in
302
+ connection with such action.
303
+
304
+ 13.8 Severability. If any provision of this Agreement is held by a court of
305
+ competent jurisdiction to be invalid, illegal, or unenforceable, the remainder
306
+ of this Agreement will remain in full force and effect.
307
+
308
+ 13.9 Waiver. Failure or neglect by either party to enforce at any time any of
309
+ the provisions of this licence Agreement shall not be construed or deemed to be
310
+ a waiver of that party's rights under this Agreement.
311
+
312
+ 13.10 Headings. The headings of sections and paragraphs of this Agreement are
313
+ for convenience of reference only and are not intended to restrict, affect or
314
+ be of any weight in the interpretation or construction of the provisions of
315
+ such sections or paragraphs.
316
+
317
+
318
+ 14. Contact Information
319
+
320
+ If you have any questions about this EULA, or if you want to contact Licensor
321
+ for any reason, please direct correspondence to contact@getductwork.io.
@@ -7,37 +7,35 @@ module Ductwork
7
7
 
8
8
  attr_reader :last_node
9
9
 
10
- def initialize(klass:, definition:, stages:)
11
- @last_node = "#{klass.name}.#{stages.length - 1}"
10
+ def initialize(last_node:, definition:)
11
+ @last_node = last_node
12
12
  @definition = definition
13
- @stages = stages
14
13
  @expansions = 0
15
14
  end
16
15
 
17
16
  def chain(next_klass)
18
- next_klass_name = "#{next_klass.name}.#{stages.length}"
17
+ next_klass_name = node_name(next_klass)
19
18
  definition[:edges][last_node][:to] = [next_klass_name]
20
19
  definition[:edges][last_node][:type] = :chain
21
20
  definition[:nodes].push(next_klass_name)
22
21
  definition[:edges][next_klass_name] ||= { klass: next_klass.name }
23
- stages.push(1)
24
22
  @last_node = next_klass_name
25
23
 
26
24
  self
27
25
  end
28
26
 
29
- def divide(to:) # rubocop:todo Metrics/AbcSize
30
- next_klass_names = to.map { |klass| "#{klass.name}.#{stages.length}" }
31
- definition[:edges][last_node][:to] = next_klass_names
27
+ def divide(to:)
28
+ next_nodes = to.map do |klass|
29
+ node = node_name(klass)
30
+ definition[:edges][node] ||= { klass: klass.name }
31
+ node
32
+ end
33
+ definition[:edges][last_node][:to] = next_nodes
32
34
  definition[:edges][last_node][:type] = :divide
33
- definition[:nodes].push(*next_klass_names)
34
- stages.push(1)
35
-
36
- sub_branches = to.map do |klass|
37
- next_klass_name = "#{klass.name}.#{stages.length - 1}"
38
- definition[:edges][next_klass_name] ||= { klass: klass.name }
35
+ definition[:nodes].push(*next_nodes)
39
36
 
40
- Ductwork::DSL::BranchBuilder.new(klass:, definition:, stages:)
37
+ sub_branches = next_nodes.map do |last_node|
38
+ Ductwork::DSL::BranchBuilder.new(last_node:, definition:)
41
39
  end
42
40
 
43
41
  yield sub_branches
@@ -45,8 +43,8 @@ module Ductwork
45
43
  self
46
44
  end
47
45
 
48
- def combine(*branch_builders, into:) # rubocop:todo Metrics/AbcSize
49
- next_klass_name = "#{into.name}.#{stages.length}"
46
+ def combine(*branch_builders, into:)
47
+ next_klass_name = node_name(into)
50
48
  definition[:edges][last_node][:to] = [next_klass_name]
51
49
  definition[:edges][last_node][:type] = :combine
52
50
 
@@ -56,18 +54,16 @@ module Ductwork
56
54
  end
57
55
  definition[:nodes].push(next_klass_name)
58
56
  definition[:edges][next_klass_name] ||= { klass: into.name }
59
- stages.push(1)
60
57
 
61
58
  self
62
59
  end
63
60
 
64
61
  def expand(to:)
65
- next_klass_name = "#{to.name}.#{stages.length}"
62
+ next_klass_name = node_name(to)
66
63
  definition[:edges][last_node][:to] = [next_klass_name]
67
64
  definition[:edges][last_node][:type] = :expand
68
65
  definition[:nodes].push(next_klass_name)
69
66
  definition[:edges][next_klass_name] ||= { klass: to.name }
70
- stages.push(1)
71
67
  @last_node = next_klass_name
72
68
  @expansions += 1
73
69
 
@@ -80,13 +76,12 @@ module Ductwork
80
76
  "Must expand pipeline definition before collapsing steps"
81
77
  end
82
78
 
83
- next_klass_name = "#{into.name}.#{stages.length}"
79
+ next_klass_name = node_name(into)
84
80
  definition[:edges][last_node][:to] = [next_klass_name]
85
81
  definition[:edges][last_node][:type] = :collapse
86
82
 
87
83
  definition[:nodes].push(next_klass_name)
88
84
  definition[:edges][next_klass_name] ||= { klass: into.name }
89
- stages.push(1)
90
85
  @last_node = next_klass_name
91
86
  @expansions -= 1
92
87
 
@@ -95,7 +90,11 @@ module Ductwork
95
90
 
96
91
  private
97
92
 
98
- attr_reader :definition, :expansions, :stages
93
+ attr_reader :definition, :expansions
94
+
95
+ def node_name(klass)
96
+ "#{klass.name}.#{SecureRandom.hex(4)}"
97
+ end
99
98
  end
100
99
  end
101
100
  end
@@ -15,14 +15,17 @@ module Ductwork
15
15
  }
16
16
  @divergences = []
17
17
  @last_nodes = []
18
- @stages = []
19
18
  end
20
19
 
21
20
  def start(klass)
22
21
  validate_classes!(klass)
23
22
  validate_start_once!
24
- add_new_nodes(klass)
25
- increment_position
23
+
24
+ node = node_name(klass)
25
+ definition[:nodes].push(node)
26
+ definition[:edges][node] = { klass: klass.name }
27
+
28
+ @last_nodes = [node]
26
29
 
27
30
  self
28
31
  end
@@ -31,24 +34,32 @@ module Ductwork
31
34
  validate_classes!(klass)
32
35
  validate_definition_started!(action: "chaining")
33
36
  add_edge_to_last_nodes(klass, type: :chain)
34
- add_new_nodes(klass)
35
- increment_position
36
37
 
37
38
  self
38
39
  end
39
40
 
40
- def divide(to:)
41
+ def divide(to:) # rubocop:todo Metrics/AbcSize
41
42
  validate_classes!(to)
42
43
  validate_definition_started!(action: "dividing chain")
43
- add_edge_to_last_nodes(*to, type: :divide)
44
- add_new_nodes(*to)
45
- increment_position
44
+ to_nodes = to.map do |to|
45
+ node = node_name(to)
46
+ definition[:edges][node] ||= { klass: to.name }
47
+ node
48
+ end
49
+ last_nodes.each do |last_node|
50
+ definition[:edges][last_node][:to] = to_nodes
51
+ definition[:edges][last_node][:type] = :divide
52
+ end
53
+
54
+ @last_nodes = Array(to_nodes)
55
+
56
+ definition[:nodes].push(*to_nodes)
46
57
  divergences.push(:divide)
47
58
 
48
59
  if block_given?
49
- branches = to.map do |klass|
60
+ branches = last_nodes.map do |last_node|
50
61
  Ductwork::DSL::BranchBuilder
51
- .new(klass:, definition:, stages:)
62
+ .new(last_node:, definition:)
52
63
  end
53
64
 
54
65
  yield branches
@@ -57,22 +68,26 @@ module Ductwork
57
68
  self
58
69
  end
59
70
 
60
- def combine(into:)
71
+ def combine(into:) # rubocop:todo Metrics/AbcSize
61
72
  validate_classes!(into)
62
73
  validate_definition_started!(action: "combining steps")
63
74
  validate_can_combine!
64
75
 
65
76
  divergences.pop
66
77
 
78
+ into_node = node_name(into)
79
+ definition[:edges][into_node] ||= { klass: into.name }
67
80
  last_nodes = definition[:nodes].reverse.select do |node|
68
81
  definition.dig(:edges, node, :to).blank?
69
82
  end
70
- last_nodes.each do |node|
71
- definition[:edges][node][:to] = ["#{into.name}.#{stages.length}"]
72
- definition[:edges][node][:type] = :combine
83
+ last_nodes.each do |last_node|
84
+ definition[:edges][last_node][:to] = [into_node]
85
+ definition[:edges][last_node][:type] = :combine
73
86
  end
74
- add_new_nodes(into)
75
- increment_position
87
+
88
+ @last_nodes = Array(into_node)
89
+
90
+ definition[:nodes].push(into_node)
76
91
 
77
92
  self
78
93
  end
@@ -81,8 +96,6 @@ module Ductwork
81
96
  validate_classes!(to)
82
97
  validate_definition_started!(action: "expanding chain")
83
98
  add_edge_to_last_nodes(to, type: :expand)
84
- add_new_nodes(to)
85
- increment_position
86
99
  divergences.push(:expand)
87
100
 
88
101
  self
@@ -93,8 +106,6 @@ module Ductwork
93
106
  validate_definition_started!(action: "collapsing steps")
94
107
  validate_can_collapse!
95
108
  add_edge_to_last_nodes(into, type: :collapse)
96
- add_new_nodes(into)
97
- increment_position
98
109
  divergences.pop
99
110
 
100
111
  self
@@ -116,7 +127,7 @@ module Ductwork
116
127
 
117
128
  private
118
129
 
119
- attr_reader :definition, :last_nodes, :divergences, :stages
130
+ attr_reader :definition, :last_nodes, :divergences
120
131
 
121
132
  def validate_classes!(klasses)
122
133
  valid = Array(klasses).all? do |klass|
@@ -164,27 +175,24 @@ module Ductwork
164
175
  end
165
176
  end
166
177
 
167
- def add_new_nodes(*klasses)
168
- nodes = klasses.map { |klass| "#{klass.name}.#{stages.length}" }
169
- @last_nodes = Array(nodes)
170
-
171
- definition[:nodes].push(*nodes)
172
- klasses.each do |klass|
173
- node = "#{klass.name}.#{stages.length}"
178
+ def add_edge_to_last_nodes(*klasses, type:)
179
+ to_nodes = klasses.map do |klass|
180
+ node = node_name(klass)
174
181
  definition[:edges][node] ||= { klass: klass.name }
182
+ node
175
183
  end
176
- end
177
-
178
- def add_edge_to_last_nodes(*klasses, type:)
179
184
  last_nodes.each do |last_node|
180
- to = klasses.map { |klass| "#{klass.name}.#{stages.length}" }
181
- definition[:edges][last_node][:to] = to
185
+ definition[:edges][last_node][:to] = to_nodes
182
186
  definition[:edges][last_node][:type] = type
183
187
  end
188
+
189
+ @last_nodes = Array(to_nodes)
190
+
191
+ definition[:nodes].push(*to_nodes)
184
192
  end
185
193
 
186
- def increment_position
187
- stages.push(1)
194
+ def node_name(klass)
195
+ "#{klass.name}.#{SecureRandom.hex(4)}"
188
196
  end
189
197
  end
190
198
  end
@@ -46,11 +46,6 @@ module Ductwork
46
46
 
47
47
  def create_threads
48
48
  klasses.map do |klass|
49
- Ductwork.logger.debug(
50
- msg: "Creating new thread",
51
- role: :pipeline_advancer_runner,
52
- pipeline: klass
53
- )
54
49
  thread = Thread.new do
55
50
  Ductwork::Processes::PipelineAdvancer
56
51
  .new(running_context, klass)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ductwork
4
- VERSION = "0.16.0"
4
+ VERSION = "0.17.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ductwork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Ewing
@@ -112,6 +112,7 @@ extensions: []
112
112
  extra_rdoc_files: []
113
113
  files:
114
114
  - CHANGELOG.md
115
+ - COMM-LICENSE.txt
115
116
  - LICENSE.txt
116
117
  - README.md
117
118
  - Rakefile