trailblazer-activity-dsl-linear 0.1.3 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9a293bea1b0c62ca51c7c47a91cfe6e694d094e35748214e9cfed55d032808e
4
- data.tar.gz: 022c28638d9fd6bd90a8432cd83d5a49e352680c8241e0c8f7bca9f6f2667aab
3
+ metadata.gz: c856e0d550eab6b731d73ab0e8908bb4d5d72004448b817d0827df4ab64417b4
4
+ data.tar.gz: 2d953bfdb16bf688fe849bc002125da89432df5d349ce263624d6c687315e896
5
5
  SHA512:
6
- metadata.gz: 4eadf2634cebbd06bcba77fb52efaaaae29cfb1c8379cb16db17a5904cc2de4a5c7c0e1df330bb20771dd5d66c3838b0c9350a2ce0ef7298967bdf6103f7a663
7
- data.tar.gz: 7ac1d9d2b41005ef573dbebefdcbef6b75346a092f426e89021ba5cf43aa8d5f747d2dc67cc9b9a1f008412b529875527622fade2de9ce6b947817a91e368774
6
+ metadata.gz: 58b2dee42d346d555806415883cec7126b29354974bcc03779bce6d623ee412c3b86262e34b97e1e06a43119d9c2c875504154a3142adcf0413109957c4a65eb
7
+ data.tar.gz: 74aa3adbad25af14f2646791480bca64b1bc39cccc716c1a84389b756b4e87ff0e1bf064141a690ab1d4d305c61a45bb46a12b792fa74b320bafa71ee895ebce
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.1.4
2
+
3
+ * Provide default `:input` and `:output` if one of them is missing.
4
+
1
5
  # 0.1.3
2
6
 
3
7
  * Simplify `:override` handling by moving it to a later position.
data/Gemfile CHANGED
@@ -8,5 +8,5 @@ gem "minitest-line"
8
8
  gem "rubocop", require: false
9
9
 
10
10
  # gem "trailblazer-context", path: "../trailblazer-context"
11
- # gem "trailblazer-developer", path: "../trailblazer-developer"
12
- # gem "trailblazer-activity", path: "../trailblazer-activity"
11
+ gem "trailblazer-developer", path: "../trailblazer-developer"
12
+ gem "trailblazer-activity", path: "../trailblazer-activity"
@@ -207,13 +207,13 @@ module Trailblazer
207
207
  end
208
208
 
209
209
  def input_output_dsl((ctx, flow_options), *)
210
- input, output = ctx[:input], ctx[:output]
210
+ config = ctx.select { |k,v| [:input, :output].include?(k) } # TODO: optimize this, we don't have to go through the entire hash.
211
211
 
212
- return Trailblazer::Activity::Right, [ctx, flow_options] unless input || output
212
+ return Trailblazer::Activity::Right, [ctx, flow_options] if config.size == 0 # no :input/:output passed.
213
213
 
214
214
  new_ctx = {}
215
215
  new_ctx[:extensions] ||= [] # FIXME
216
- new_ctx[:extensions] += [Linear.VariableMapping(input: input, output: output)]
216
+ new_ctx[:extensions] += [Linear.VariableMapping(**config)]
217
217
 
218
218
  return Trailblazer::Activity::Right, [ctx.merge(new_ctx), flow_options]
219
219
  end
@@ -4,20 +4,16 @@ module Trailblazer
4
4
  module Linear
5
5
  # Normalizer-steps to implement {:input} and {:output}
6
6
  # Returns an Extension instance to be thrown into the `step` DSL arguments.
7
- def self.VariableMapping(input:, output:)
8
- input = #TaskWrap::Input.new(
9
- VariableMapping::Input::Scoped.new(
10
- Trailblazer::Option::KW( VariableMapping::filter_for(input) )
11
- # ->(*args) { raise args.inspect }
12
- )
13
- #)
7
+ def self.VariableMapping(input: VariableMapping.default_input, output: VariableMapping.default_output)
8
+ input =
9
+ VariableMapping::Input::Scoped.new(
10
+ Trailblazer::Option::KW( VariableMapping::filter_for(input) )
11
+ )
14
12
 
15
- output = #TaskWrap::Output.new(
13
+ output =
16
14
  VariableMapping::Output::Unscoped.new(
17
15
  Trailblazer::Option::KW( VariableMapping::filter_for(output) )
18
- # ),
19
- # id: :dsl_input_output
20
- )
16
+ )
21
17
 
22
18
  TaskWrap::Extension(
23
19
  merge: TaskWrap::VariableMapping.merge_for(input, output, id: input.object_id), # wraps filters: {Input(input), Output(output)}
@@ -25,8 +21,23 @@ module Trailblazer
25
21
  end
26
22
 
27
23
  module VariableMapping
24
+ module_function
25
+
26
+ # @private
27
+ def default_output
28
+ ->(scoped, **) do
29
+ _wrapped, mutable = scoped.decompose # `_wrapped` is what the `:input` filter returned, `mutable` is what the task wrote to `scoped`.
30
+ mutable
31
+ end
32
+ end
33
+
34
+ # @private
35
+ def default_input
36
+ ->(ctx, **) { ctx }
37
+ end
38
+
28
39
  # @private
29
- def self.filter_for(filter)
40
+ def filter_for(filter)
30
41
  if filter.is_a?(::Array) || filter.is_a?(::Hash)
31
42
  DSL.filter_from_dsl(filter)
32
43
  else
@@ -3,7 +3,7 @@ module Trailblazer
3
3
  module Activity
4
4
  module DSL
5
5
  module Linear
6
- VERSION = "0.1.3"
6
+ VERSION = "0.1.4"
7
7
  end
8
8
  end
9
9
  end
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.1.3
4
+ version: 0.1.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-05-31 00:00:00.000000000 Z
11
+ date: 2019-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trailblazer-activity