trailblazer-activity-dsl-linear 0.4.1 → 0.4.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48015005cd4c2e881df17be4be592445bdf9c528bd4b720bd521a4b96551c646
|
4
|
+
data.tar.gz: 6d9ed497b87bae7ebb106beb99e508eefd0c8f2bc3b5b2a07cf6fdf582f1aac1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b221f07fccc51338300aa8bba4435edf4990e366667d381d060a5b31f1dff3badd6888ff6d5db0597fc378538bda1d6658d7c1e30073397c08f58f459ca87954
|
7
|
+
data.tar.gz: 2ea9893cfbf3ac551e01128c4e14adf524c84235d4129d7e7cb1f9f84bf1a9b665c4f4a920fa36d557fcc837f2adfd6ac12eb72c61c8e300476ac6a3f72cc901
|
data/CHANGES.md
CHANGED
@@ -246,13 +246,21 @@ module Trailblazer
|
|
246
246
|
index = Linear::Insert.find_index(sequence, id)
|
247
247
|
row = sequence[index] # from this row we're inheriting options.
|
248
248
|
|
249
|
-
|
249
|
+
connections = get_inheritable_connections(ctx, row[3][:connections])
|
250
|
+
extensions = Array(row[3][:extensions]) + Array(ctx[:extensions])
|
250
251
|
|
251
|
-
ctx = ctx.merge(connections:
|
252
|
+
ctx = ctx.merge(connections: connections, extensions: extensions) # "inherit"
|
252
253
|
|
253
254
|
return Trailblazer::Activity::Right, [ctx, flow_options]
|
254
255
|
end
|
255
256
|
|
257
|
+
# return connections from {parent} step which are supported by current step
|
258
|
+
private def get_inheritable_connections(ctx, parent_connections)
|
259
|
+
return parent_connections unless ctx[:outputs]
|
260
|
+
|
261
|
+
parent_connections.slice(*ctx[:outputs].keys)
|
262
|
+
end
|
263
|
+
|
256
264
|
# TODO: make this extendable!
|
257
265
|
def cleanup_options((ctx, flow_options), *)
|
258
266
|
# new_ctx = ctx.reject { |k, v| [:connections, :outputs, :end_id, :step_interface_builder, :failure_end, :track_name, :sequence].include?(k) }
|
@@ -81,12 +81,27 @@ module Trailblazer
|
|
81
81
|
}
|
82
82
|
end
|
83
83
|
|
84
|
+
def normalize_duplications((ctx, flow_options), *)
|
85
|
+
return Right, [ctx, flow_options] if ctx[:replace]
|
86
|
+
|
87
|
+
signal, (ctx, flow_options) = raise_on_duplicate_id([ctx, flow_options])
|
88
|
+
signal, (ctx, flow_options) = clone_duplicate_activity([ctx, flow_options])
|
89
|
+
|
90
|
+
return signal, [ctx, flow_options]
|
91
|
+
end
|
92
|
+
|
84
93
|
def raise_on_duplicate_id((ctx, flow_options), *)
|
85
|
-
id, sequence
|
94
|
+
id, sequence = ctx[:id], ctx[:sequence]
|
95
|
+
raise "ID #{id} is already taken. Please specify an `:id`." if sequence.find { |row| row[3][:id] == id }
|
86
96
|
|
87
|
-
|
88
|
-
|
89
|
-
|
97
|
+
return Right, [ctx, flow_options]
|
98
|
+
end
|
99
|
+
|
100
|
+
def clone_duplicate_activity((ctx, flow_options), *)
|
101
|
+
return Right, [ctx, flow_options] unless ctx[:task].is_a?(Class)
|
102
|
+
|
103
|
+
task, sequence = ctx[:task], ctx[:sequence]
|
104
|
+
ctx = ctx.merge(task: task.clone) if sequence.find { |row| row[1] == task }
|
90
105
|
|
91
106
|
return Right, [ctx, flow_options]
|
92
107
|
end
|
@@ -104,12 +119,12 @@ module Trailblazer
|
|
104
119
|
prepend_to_path(
|
105
120
|
sequence,
|
106
121
|
|
107
|
-
"path.outputs"
|
108
|
-
"path.connections"
|
109
|
-
"path.sequence_insert"
|
110
|
-
"path.
|
111
|
-
"path.magnetic_to"
|
112
|
-
"path.wirings"
|
122
|
+
"path.outputs" => method(:merge_path_outputs),
|
123
|
+
"path.connections" => method(:merge_path_connections),
|
124
|
+
"path.sequence_insert" => method(:normalize_sequence_insert),
|
125
|
+
"path.normalize_duplications" => method(:normalize_duplications),
|
126
|
+
"path.magnetic_to" => method(:normalize_magnetic_to),
|
127
|
+
"path.wirings" => Linear::Normalizer.method(:compile_wirings),
|
113
128
|
)
|
114
129
|
end
|
115
130
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer-activity-dsl-linear
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trailblazer-activity
|