trailblazer-activity-dsl-linear 0.1.6 → 0.1.7

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: 7b02157ace82f52b99fb1360d907e39b67cfb0c2c180a6047a153fbb035811b3
4
- data.tar.gz: c0a1bf7d269c9d561eac2e89fdade0c3fe3ffb4cbc15a5cb50de63d1c21dc3fb
3
+ metadata.gz: 2eccbd6b077b017f81d57ddc1dbc564c903fec72a83e4496118e31098be0a06e
4
+ data.tar.gz: 92ed613fe58920562d059b2b3affc155b07aca0f1a7c0a20813d45da1f6be5b5
5
5
  SHA512:
6
- metadata.gz: c091e63f94d367b504fe7a70acb6b4f67f331e28297346ec2e7f264013e7dd9f3822bfe1506ccc13139d30730f515c543b897245cbd4ac7847dc8a7e0b2581c0
7
- data.tar.gz: 9ed5b5dc59547e4200d5e9d5d8972bf6b21e5279bcedcbfaad37be40015001ca431fcba0ec185007a2c02347c2b3be49127758cbfe783bb8279708babd641248
6
+ metadata.gz: 68564dcce8e6b423868b5633e5ab7cb1c46402e1d74b963eb4898e994aadc605d75f365f172436aa59b20c074f1b65440b68af4cc1e623be789a33dc0adb299e
7
+ data.tar.gz: 695efbb135d86cc05d93387e9b24ee422806a3fb5a98099b29a4bc034f58d385d18670994131aa442ce92bd547980caded1a1e65bbf0d5c2297c501c176a8e87
data/CHANGES.md CHANGED
@@ -1,6 +1,10 @@
1
+ # 0.1.7
2
+
3
+ * Add `:connect_to` option to `Path()` to allow re-joining a branched activity.
4
+
1
5
  # 0.1.6
2
6
 
3
- * Use `activity-0.1.6`.
7
+ * Use `activity-0.8.3`.
4
8
 
5
9
  # 0.1.5
6
10
 
@@ -38,7 +38,7 @@ module Trailblazer
38
38
  Id.new(id).freeze
39
39
  end
40
40
 
41
- def Path(track_color: "track_#{rand}", end_id:, **options, &block)
41
+ def Path(track_color: "track_#{rand}", end_id:"path_end_#{rand}", connect_to:nil, **options, &block)
42
42
  # DISCUSS: here, we use the global normalizer and don't allow injection.
43
43
  state = Activity::Path::DSL::State.new(Activity::Path::DSL.OptionsForState(track_name: track_color, end_id: end_id, **options)) # TODO: test injecting {:normalizers}.
44
44
 
@@ -47,7 +47,25 @@ module Trailblazer
47
47
 
48
48
  seq = state.to_h[:sequence]
49
49
 
50
- seq = Linear.strip_start_and_ends(seq, end_id: nil) # don't cut off end.
50
+ _end_id =
51
+ if connect_to
52
+ end_id
53
+ else
54
+ nil
55
+ end
56
+
57
+ seq = Linear.strip_start_and_ends(seq, end_id: _end_id) # don't cut off end unless {:connect_to} is set.
58
+
59
+ if connect_to
60
+ output, _ = seq[-1][2][0].(seq, seq[-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
61
+
62
+ searches = [Linear::Search.ById(output, connect_to.value)]
63
+
64
+ row = seq[-1]
65
+ 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
66
+
67
+ seq = seq[0..-2] + [row]
68
+ end
51
69
 
52
70
  # Add the path before End.success - not sure this is bullet-proof.
53
71
  adds = seq.collect do |row|
@@ -57,6 +75,7 @@ module Trailblazer
57
75
  }
58
76
  end
59
77
 
78
+ # Connect the Output() => Track(path_track)
60
79
  return Track.new(track_color, adds)
61
80
  end
62
81
 
@@ -115,6 +115,7 @@ module Trailblazer
115
115
  end
116
116
 
117
117
  # Compile the actual {Seq::Row}'s {wiring}.
118
+ # This combines {:connections} and {:outputs}
118
119
  def compile_wirings((ctx, flow_options), *)
119
120
  connections = ctx[:connections] || raise # FIXME
120
121
  outputs = ctx[:outputs] || raise # FIXME
@@ -3,7 +3,7 @@ module Trailblazer
3
3
  module Activity
4
4
  module DSL
5
5
  module Linear
6
- VERSION = "0.1.6"
6
+ VERSION = "0.1.7"
7
7
  end
8
8
  end
9
9
  end
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Nick Sutterer"]
10
10
  spec.email = ["apotonick@gmail.com"]
11
11
 
12
- spec.summary = %q(Simple DSL to compile Trailblazer activities.)
13
- spec.description = %q(Simple DSL to compile Trailblazer activities with arbitrary wirings.)
12
+ spec.summary = %q(Simple DSL to define Trailblazer activities.)
13
+ spec.description = %q(Simple DSL to define Trailblazer activities with arbitrary wirings.)
14
14
  spec.homepage = "http://trailblazer.to"
15
15
  spec.licenses = ["LGPL-3.0"]
16
16
 
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency "trailblazer-activity", ">= 0.8.3", "< 1.0.0"
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.14"
24
+ spec.add_development_dependency "bundler"
25
25
  spec.add_development_dependency "minitest", "~> 5.0"
26
26
  spec.add_development_dependency "rake"
27
27
  spec.add_development_dependency "trailblazer-developer", ">= 0.0.3"
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.6
4
+ version: 0.1.7
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-07-19 00:00:00.000000000 Z
11
+ date: 2019-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trailblazer-activity
@@ -34,16 +34,16 @@ dependencies:
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '1.14'
39
+ version: '0'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: '1.14'
46
+ version: '0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: minitest
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -86,7 +86,7 @@ dependencies:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: 0.0.3
89
- description: Simple DSL to compile Trailblazer activities with arbitrary wirings.
89
+ description: Simple DSL to define Trailblazer activities with arbitrary wirings.
90
90
  email:
91
91
  - apotonick@gmail.com
92
92
  executables: []
@@ -138,5 +138,5 @@ rubyforge_project:
138
138
  rubygems_version: 2.7.3
139
139
  signing_key:
140
140
  specification_version: 4
141
- summary: Simple DSL to compile Trailblazer activities.
141
+ summary: Simple DSL to define Trailblazer activities.
142
142
  test_files: []