trailblazer-activity-dsl-linear 0.2.3 → 0.2.4
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 +4 -4
- data/CHANGES.md +4 -0
- data/lib/trailblazer/activity/dsl/linear/helper.rb +27 -1
- data/lib/trailblazer/activity/dsl/linear/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8dd3e02254b671396f311179af67026769e83716736abf5b760ea1ac149da89
|
4
|
+
data.tar.gz: 15cf93cb0c977ce2c7abd72d8f4e2866c79ff529e7bbb289a3f9baf8c7c2c350
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f26e85575fa37251c27f3c63d1ed0d172ad042153cbb10adcd790b627b51794f3f4f404c74cca4c5bbdf8dc5fe9aad0083db0ea4817cd1ac9356f4cc1824072d
|
7
|
+
data.tar.gz: ca25f0e7612524e6cbd1917e72a0c58256e4ab1f4e1c36232ab1c17c123c14637eda6891a881948812f0bbe6d4801e72cb03d22d699e16f80a655fea4ec463f9
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 0.2.4
|
2
|
+
|
3
|
+
* Add a minimal API for patching nested activities. This allows customizing deeply-nested activities without changing the original.
|
4
|
+
|
1
5
|
# 0.2.3
|
2
6
|
|
3
7
|
* Add `Strategy::invoke` which is a short-cut to `TaskWrap.invoke`. It's available as class method in all three strategies.
|
@@ -80,13 +80,39 @@ module Trailblazer
|
|
80
80
|
end
|
81
81
|
|
82
82
|
# Computes the {:outputs} options for {activity}.
|
83
|
-
def Subprocess(activity)
|
83
|
+
def Subprocess(activity, path=[], patch=nil)
|
84
|
+
activity = Patch.(activity, path, patch) if path.any?
|
85
|
+
|
84
86
|
{
|
85
87
|
task: activity,
|
86
88
|
outputs: Hash[activity.to_h[:outputs].collect { |output| [output.semantic, output] }]
|
87
89
|
}
|
88
90
|
end
|
89
91
|
|
92
|
+
module Patch
|
93
|
+
module_function
|
94
|
+
|
95
|
+
def call(activity, path, customization)
|
96
|
+
task_id, *path = path
|
97
|
+
|
98
|
+
|
99
|
+
patch =
|
100
|
+
if task_id
|
101
|
+
segment_activity = Introspect::Graph(activity).find(task_id).task
|
102
|
+
patched_segment_activity = call(segment_activity, path, customization)
|
103
|
+
|
104
|
+
# Replace the patched subprocess.
|
105
|
+
-> { step Subprocess(patched_segment_activity), replace: task_id, id: task_id }
|
106
|
+
else
|
107
|
+
customization # apply the *actual* patch from the Subprocess() call.
|
108
|
+
end
|
109
|
+
|
110
|
+
patched_activity = Class.new(activity)
|
111
|
+
patched_activity.class_exec(&patch)
|
112
|
+
patched_activity
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
90
116
|
def normalize(options, local_keys) # TODO: test me.
|
91
117
|
locals = options.reject { |key, value| ! local_keys.include?(key) }
|
92
118
|
foreign = options.reject { |key, value| local_keys.include?(key) }
|
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.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trailblazer-activity
|