trailblazer-activity-dsl-linear 0.3.3 → 0.3.4
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: f64e4cda0443bb3635a41f04a79ea5f12193ace7aac22d613eb3ce0749d3d303
|
4
|
+
data.tar.gz: ade9350dfbf4475edb0a67190d4e9cd37cbca8f838b27c63c5be21780b9d466d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2ad5a07613723c38ec2a29100b33a4b983451eca8d34884da03b6a98a3441709aa8e2f4c05d7717aebcbe3b6d47b3f3a07b389469396bea8cb6befd24ea1c1b
|
7
|
+
data.tar.gz: 1ac0b62f981d089cec84331ccb524b20f2f7aca089ed8e944ce422de126646176f0e66752a878d124cdf828d6261fd2d52e2e9ec63c2ade7eba658fa4bb9f3da
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# 0.3.4
|
2
|
+
|
3
|
+
* Allow DSL helpers such as `End()` in `Path()`.
|
4
|
+
* Introduce `Path(..., before: )` option to insert all path member steps before a certain element.
|
5
|
+
* Allow `Path(..., connect_to: Track(..))`.
|
6
|
+
|
1
7
|
# 0.3.3
|
2
8
|
|
3
9
|
* Fix for registering `PassFast` & `FailFast` ends in `FastTrack` to fix circuit interface callables which emits those signals.
|
@@ -43,33 +43,16 @@ module Trailblazer
|
|
43
43
|
Id.new(id).freeze
|
44
44
|
end
|
45
45
|
|
46
|
-
def Path(track_color: "track_#{rand}",
|
47
|
-
|
48
|
-
|
46
|
+
def Path(track_color: "track_#{rand}", connect_to: nil, before: false, **options, &block)
|
47
|
+
path = Activity::Path(track_name: track_color, **options)
|
48
|
+
activity = Class.new(path) { self.instance_exec(&block) }
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
seq = state.to_h[:sequence]
|
54
|
-
|
55
|
-
_end_id =
|
56
|
-
if connect_to
|
57
|
-
end_id
|
58
|
-
else
|
59
|
-
nil
|
60
|
-
end
|
61
|
-
|
62
|
-
seq = strip_start_and_ends(seq, end_id: _end_id) # don't cut off end unless {:connect_to} is set.
|
50
|
+
seq = activity.instance_variable_get(:@state).to_h[:sequence] # TODO: fix @state interface
|
51
|
+
# Strip default ends `Start.default` and `End.success` (if present).
|
52
|
+
seq = seq[1..-1].reject{ |row| row[3][:stop_event] && row[3][:id] == 'End.success' }
|
63
53
|
|
64
54
|
if connect_to
|
65
|
-
|
66
|
-
|
67
|
-
searches = [Search.ById(output, connect_to.value)]
|
68
|
-
|
69
|
-
row = seq[-1]
|
70
|
-
row = row[0..1] + [searches] + [row[3]] # FIXME: not mutating an array is so hard: we only want to replace the "searches" element, index 2
|
71
|
-
|
72
|
-
seq = seq[0..-2] + [row]
|
55
|
+
seq = connect_for_sequence(seq, connect_to: connect_to)
|
73
56
|
end
|
74
57
|
|
75
58
|
# Add the path elements before {End.success}.
|
@@ -80,9 +63,12 @@ module Trailblazer
|
|
80
63
|
# the terminus of the path goes _after_ {End.success} into the "end group".
|
81
64
|
insert_method = options[:stop_event] ? Insert.method(:Append) : Insert.method(:Prepend)
|
82
65
|
|
66
|
+
insert_target = "End.success" # insert before/after
|
67
|
+
insert_target = before if before && connect_to.instance_of?(Trailblazer::Activity::DSL::Linear::Helper::Track) # FIXME: this is a bit hacky, of course!
|
68
|
+
|
83
69
|
{
|
84
70
|
row: row,
|
85
|
-
insert: [insert_method,
|
71
|
+
insert: [insert_method, insert_target]
|
86
72
|
}
|
87
73
|
end
|
88
74
|
|
@@ -90,6 +76,23 @@ module Trailblazer
|
|
90
76
|
return Track.new(track_color, adds, {})
|
91
77
|
end
|
92
78
|
|
79
|
+
# Connect last row of the {sequence} to the given step via its {Id}
|
80
|
+
# Useful when steps needs to be inserted in between {Start} and {connect Id()}.
|
81
|
+
private def connect_for_sequence(sequence, connect_to:)
|
82
|
+
output, _ = sequence[-1][2][0].(sequence, sequence[-1]) # FIXME: the Forward() proc contains the row's Output, and the only current way to retrieve it is calling the search strategy. It should be Forward#to_h
|
83
|
+
|
84
|
+
# searches = [Search.ById(output, connect_to.value)]
|
85
|
+
searches = [Search.ById(output, connect_to.value)] if connect_to.instance_of?(Trailblazer::Activity::DSL::Linear::Helper::Id)
|
86
|
+
searches = [Search.Forward(output, connect_to.color)] if connect_to.instance_of?(Trailblazer::Activity::DSL::Linear::Helper::Track) # FIXME: use existing mapping logic!
|
87
|
+
|
88
|
+
row = sequence[-1]
|
89
|
+
row = row[0..1] + [searches] + [row[3]] # FIXME: not mutating an array is so hard: we only want to replace the "searches" element, index 2
|
90
|
+
|
91
|
+
sequence = sequence[0..-2] + [row]
|
92
|
+
|
93
|
+
sequence
|
94
|
+
end
|
95
|
+
|
93
96
|
# Computes the {:outputs} options for {activity}.
|
94
97
|
def Subprocess(activity, patch: {})
|
95
98
|
activity = Patch.customize(activity, options: patch)
|
@@ -74,7 +74,7 @@ module Trailblazer
|
|
74
74
|
return args[0], options.merge(evaluated_options)
|
75
75
|
end
|
76
76
|
|
77
|
-
def Path(options, &block) # syntactically, we can't access the {do ... end} block here.
|
77
|
+
def Path(**options, &block) # syntactically, we can't access the {do ... end} block here.
|
78
78
|
BlockProxy.new(options, block)
|
79
79
|
end
|
80
80
|
|
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.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trailblazer-activity
|
@@ -120,7 +120,7 @@ homepage: http://trailblazer.to
|
|
120
120
|
licenses:
|
121
121
|
- LGPL-3.0
|
122
122
|
metadata: {}
|
123
|
-
post_install_message:
|
123
|
+
post_install_message:
|
124
124
|
rdoc_options: []
|
125
125
|
require_paths:
|
126
126
|
- lib
|
@@ -135,8 +135,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
|
-
|
139
|
-
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.7.3
|
140
|
+
signing_key:
|
140
141
|
specification_version: 4
|
141
142
|
summary: Simple DSL to define Trailblazer activities.
|
142
143
|
test_files: []
|