trailblazer-developer 0.0.11 → 0.0.16

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: 1bd9598d12d74fcd1dcbe20a50d53642ee2fe9ca8aad9648332630dee4b8fb7a
4
- data.tar.gz: bc6b62c30541f118e756d72646da251cdbc2eef1d95dcb806c22aca10c1b64d3
3
+ metadata.gz: a94a8ac8694a1873372e769d083aa50930d5b5ecac8bfd774fe9416583c0de6f
4
+ data.tar.gz: af93d4503430bd88878d1797849c6546cf48f3a1b1be3c66096dff7e7dea7763
5
5
  SHA512:
6
- metadata.gz: ce2bc17462233a132411006e1bcb0d2b992e8e378faef8293d2be1d2916c691aba17def994644d7ae1428f65302d8d6496dc0fe583e484c036015415d9e4349e
7
- data.tar.gz: f621040bab0043a71332f8a5ff325aae117612ba105116c527b57b4caacdeb52e067a2d8b5d5f6fadd5d290231fbb1c07ca1a036635d17d13a92d52c3e702629
6
+ metadata.gz: '08cd8a7b2b2ac54d86454e8c4a497a4462ffae30e05b74d87f557297716918f18dc4b091982f62ef13891cec0bd40ca6cc1edce44af48feb994ef7c94e8623e8'
7
+ data.tar.gz: b12a63e25446af1e74205c4168684e8ded06de676849638f7180a837690dc5a56c90396d978da0a836995753f3b9b9dfd3366db96e5165cd3462a1009c5cbb01
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.6.2
4
- - 2.5.5
5
- - 2.4.4
3
+ - 2.6
4
+ - 2.5
5
+ - 2.4
6
6
 
7
7
  cache: bundler
@@ -1,3 +1,24 @@
1
+ # 0.0.16
2
+
3
+ * Remove Declarative warning correctly
4
+
5
+ # 0.0.15
6
+
7
+ * Fix `Dev.wtf` circuit interface definition
8
+
9
+ # 0.0.14
10
+
11
+ * Revert declarative warning changes
12
+
13
+ # 0.0.13
14
+
15
+ * Allow focusing on selected variables for all steps in wtf
16
+ * Fix declarative deprecation warning
17
+
18
+ # 0.0.12
19
+
20
+ * Revert Hash#compact usage to support Rubies <= 2.4
21
+
1
22
  # 0.0.11
2
23
 
3
24
  * Allow injecting custom data collector in Trace API, to collect custom input/output ctx of task nodes.
data/Rakefile CHANGED
@@ -1,6 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
- require "rubocop/rake_task"
4
3
 
5
4
  Rake::TestTask.new(:test) do |t|
6
5
  t.libs << "test"
@@ -8,7 +7,5 @@ Rake::TestTask.new(:test) do |t|
8
7
  t.test_files = FileList["test/**/*_test.rb"]
9
8
  end
10
9
 
11
- RuboCop::RakeTask.new(:rubocop)
12
-
13
10
  desc "Running Tests"
14
11
  task default: %i[test]
@@ -31,7 +31,7 @@ module Trailblazer::Developer
31
31
  return false unless response.status == 200
32
32
 
33
33
  # token = CGI::Cookie.parse(response.headers["set-cookie"])["token"][0]
34
- token = JSON.parse(response.body)["token"]
34
+ JSON.parse(response.body)["token"]
35
35
  end
36
36
 
37
37
  def export_diagram(id:, query:, **options)
@@ -60,7 +60,7 @@ module Trailblazer::Developer
60
60
  def request(host:, url:, method:, token:, body:, **)
61
61
  conn = Faraday.new(url: host)
62
62
 
63
- response = conn.send(method) do |req|
63
+ conn.send(method) do |req|
64
64
  req.url url
65
65
  req.headers["Content-Type"] = "application/json"
66
66
  req.body = body
@@ -17,7 +17,7 @@ module Trailblazer
17
17
  collection :elements, class: Element do
18
18
  property :id
19
19
  property :type
20
- collection :linksTo, class: Arrow, default: [] do
20
+ collection :linksTo, class: Arrow, default: ::Declarative::Variables::Append([]) do
21
21
  property :target
22
22
  property :label
23
23
  property :message
@@ -31,7 +31,7 @@ module Trailblazer
31
31
  end
32
32
 
33
33
  def call(hash)
34
- signal, (ctx, _) = Activity::TaskWrap.invoke(Pipeline, hash: hash)
34
+ _, (ctx, _) = Activity::TaskWrap.invoke(Pipeline, hash: hash)
35
35
  ctx[:intermediate]
36
36
  end
37
37
 
@@ -51,16 +51,16 @@ module Trailblazer
51
51
  wiring = elements.collect { |el|
52
52
  data = data_for(el)
53
53
 
54
- [inter.TaskRef(el.id, data), el.linksTo.collect { |arrow| inter.Out(semantic_for(arrow.to_h), arrow.target) } ] }
54
+ [inter.TaskRef(el.id, data), el.linksTo.collect { |arrow| inter.Out(semantic_for(**arrow.to_h), arrow.target) } ] }
55
55
  wiring = Hash[wiring]
56
56
 
57
57
  # end events need this stupid special handling
58
58
  # DISCUSS: currently, the END-SEMANTIC is read from the event's label.
59
59
  wiring = wiring.merge(Hash[
60
60
  end_events.collect do |_end|
61
- ref, outputs = wiring.find { |ref, _| ref.id == _end.id }
61
+ ref, = wiring.find { |ref, _| ref.id == _end.id }
62
62
 
63
- [ref, [inter.Out(semantic_for(_end.to_h)|| raise, nil)]] # TODO: test the raise, happens when the semantic of an End can't be distinguished. # TODO: don't extract semantic from :label but from :data.
63
+ [ref, [inter.Out(semantic_for(**_end.to_h)|| raise, nil)]] # TODO: test the raise, happens when the semantic of an End can't be distinguished. # TODO: don't extract semantic from :label but from :data.
64
64
  end
65
65
  ])
66
66
  # pp wiring
@@ -7,10 +7,10 @@ module Trailblazer::Developer
7
7
 
8
8
  class << self
9
9
  # Public entry point to activate tracing when running {activity}.
10
- def call(activity, (ctx, flow_options), circuit_options={})
11
- activity, (ctx, flow_options), circuit_options = Trace.arguments_for_call( activity, [ctx, flow_options], circuit_options ) # only run once for the entire circuit!
10
+ def call(activity, (ctx, flow_options), **circuit_options)
11
+ activity, (ctx, flow_options), circuit_options = Trace.arguments_for_call( activity, [ctx, flow_options], **circuit_options ) # only run once for the entire circuit!
12
12
 
13
- signal, (ctx, flow_options) = Activity::TaskWrap.invoke(activity, [ctx, flow_options], circuit_options)
13
+ signal, (ctx, flow_options) = Activity::TaskWrap.invoke(activity, [ctx, flow_options], **circuit_options)
14
14
 
15
15
  return flow_options[:stack], signal, [ctx, flow_options]
16
16
  end
@@ -30,7 +30,12 @@ module Trailblazer
30
30
  # message: "WTF!"
31
31
  # seq: [:a]
32
32
  def tree_nodes_for(level, input:, output:, **options)
33
- input_output_nodes = { Input: input, Output: output }.compact.collect do |table_header, entity|
33
+ # TODO: Reverting `Hash#compact` usage as it is not supported in Ruby <= 2.4
34
+ # Once the support is droped, revert actual code with below and remove entity check.
35
+ # input_output_nodes = { Input: input, Output: output }.compact.collect do |table_header, entity|
36
+
37
+ input_output_nodes = { Input: input, Output: output }.collect do |table_header, entity|
38
+ next unless entity
34
39
  next unless Array( entity.data[:focused_variables] ).any?
35
40
 
36
41
  table = vertical_table_for(entity.data[:focused_variables], table_header: table_header)
@@ -14,7 +14,7 @@ module Trailblazer::Developer
14
14
  end
15
15
 
16
16
  def tree(stack, level, tree:, renderer:, **options)
17
- tree_for(stack, level, options.merge(tree: tree))
17
+ tree_for(stack, level, **options.merge(tree: tree))
18
18
 
19
19
  nodes = tree.each_with_index.map do |task_node, position|
20
20
  renderer.(task_node: task_node, position: position, tree: tree)
@@ -30,7 +30,7 @@ module Trailblazer::Developer
30
30
  tree.push(*TreeNodes.for(level, options.merge(input: input, output: output)))
31
31
 
32
32
  if nested.any? # nesting
33
- tree_for(nested, level + 1, options.merge(tree: tree))
33
+ tree_for(nested, level + 1, **options.merge(tree: tree))
34
34
  end
35
35
 
36
36
  tree
@@ -1,7 +1,7 @@
1
1
  module Trailblazer
2
2
  module Version
3
3
  module Developer
4
- VERSION = "0.0.11"
4
+ VERSION = "0.0.16"
5
5
  end
6
6
  end
7
7
  end
@@ -14,13 +14,13 @@ module Trailblazer::Developer
14
14
 
15
15
  # Run {activity} with tracing enabled and inject a mutable {Stack} instance.
16
16
  # This allows to display the trace even when an exception happened
17
- def invoke(activity, (ctx, flow_options), *circuit_options)
17
+ def invoke(activity, (ctx, flow_options), **circuit_options)
18
18
  activity, (ctx, flow_options), circuit_options = Wtf.arguments_for_trace(
19
- activity, [ctx, flow_options], *circuit_options
19
+ activity, [ctx, flow_options], circuit_options
20
20
  )
21
21
 
22
22
  _returned_stack, signal, (ctx, flow_options) = Trace.invoke(
23
- activity, [ctx, flow_options], *circuit_options
23
+ activity, [ctx, flow_options], circuit_options
24
24
  )
25
25
 
26
26
  return signal, [ctx, flow_options], circuit_options
@@ -57,10 +57,11 @@ module Trailblazer::Developer
57
57
 
58
58
  # Overring default input and output data collectors to collect/capture
59
59
  # 1. inspect of focusable variables for given focusable step
60
+ # 2. Or inspect of focused variables for all steps
60
61
  def trace_input_data_collector(wrap_config, (ctx, flow_options), circuit_options)
61
62
  data = Trace.default_input_data_collector(wrap_config, [ctx, flow_options], circuit_options)
62
63
 
63
- if flow_options[:focus_on][:steps].include?(data[:task_name])
64
+ if Wtf.caputure_variables?(step_name: data[:task_name], **flow_options)
64
65
  data[:focused_variables] = Trace::Focusable.capture_variables_from(ctx, **flow_options)
65
66
  end
66
67
 
@@ -68,14 +69,21 @@ module Trailblazer::Developer
68
69
  end
69
70
 
70
71
  def trace_output_data_collector(wrap_config, (ctx, flow_options), circuit_options)
71
- data = Trace.default_output_data_collector(wrap_config, [ctx, flow_options], circuit_options)
72
-
72
+ data = Trace.default_output_data_collector(wrap_config, [ctx, flow_options], circuit_options)
73
73
  input = flow_options[:stack].top
74
- if flow_options[:focus_on][:steps].include?(input.data[:task_name])
74
+
75
+ if Wtf.caputure_variables?(step_name: input.data[:task_name], **flow_options)
75
76
  data[:focused_variables] = Trace::Focusable.capture_variables_from(ctx, **flow_options)
76
77
  end
77
78
 
78
79
  data
79
80
  end
81
+
82
+ # private
83
+ def caputure_variables?(step_name:, focus_on:, **)
84
+ return true if focus_on[:steps].include?(step_name) # For given step
85
+ return true if focus_on[:steps].empty? && focus_on[:variables].any? # For selected vars but all steps
86
+ return false
87
+ end
80
88
  end
81
89
  end
@@ -22,9 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "minitest"
23
23
  spec.add_development_dependency "minitest-line"
24
24
  spec.add_development_dependency "rake"
25
- spec.add_development_dependency "rubocop"
26
25
 
27
- spec.add_dependency "trailblazer-activity", ">= 0.10.0", "< 1.0.0"
26
+ spec.add_dependency "trailblazer-activity", ">= 0.11.0", "< 1.0.0"
28
27
  spec.add_dependency "trailblazer-activity-dsl-linear"
29
28
  spec.add_dependency "representable"
30
29
  spec.add_dependency "hirb"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trailblazer-developer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.16
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-03-03 00:00:00.000000000 Z
11
+ date: 2020-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,27 +66,13 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: trailblazer-activity
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - ">="
88
74
  - !ruby/object:Gem::Version
89
- version: 0.10.0
75
+ version: 0.11.0
90
76
  - - "<"
91
77
  - !ruby/object:Gem::Version
92
78
  version: 1.0.0
@@ -96,7 +82,7 @@ dependencies:
96
82
  requirements:
97
83
  - - ">="
98
84
  - !ruby/object:Gem::Version
99
- version: 0.10.0
85
+ version: 0.11.0
100
86
  - - "<"
101
87
  - !ruby/object:Gem::Version
102
88
  version: 1.0.0
@@ -150,8 +136,8 @@ extensions: []
150
136
  extra_rdoc_files: []
151
137
  files:
152
138
  - ".gitignore"
153
- - ".rubocop.yml"
154
139
  - ".travis.yml"
140
+ - CHANGES.md
155
141
  - Gemfile
156
142
  - LICENSE
157
143
  - README.md
@@ -160,7 +146,6 @@ files:
160
146
  - bin/setup
161
147
  - gems.local.rb
162
148
  - lib/trailblazer/developer.rb
163
- - lib/trailblazer/developer/CHANGES.md
164
149
  - lib/trailblazer/developer/client.rb
165
150
  - lib/trailblazer/developer/generate.rb
166
151
  - lib/trailblazer/developer/render/circuit.rb
@@ -178,7 +163,7 @@ homepage: http://trailblazer.to
178
163
  licenses:
179
164
  - LGPL-3.0
180
165
  metadata: {}
181
- post_install_message:
166
+ post_install_message:
182
167
  rdoc_options: []
183
168
  require_paths:
184
169
  - lib
@@ -193,8 +178,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
178
  - !ruby/object:Gem::Version
194
179
  version: '0'
195
180
  requirements: []
196
- rubygems_version: 3.0.6
197
- signing_key:
181
+ rubygems_version: 3.1.2
182
+ signing_key:
198
183
  specification_version: 4
199
184
  summary: Developer tools for Trailblazer.
200
185
  test_files: []
@@ -1,36 +0,0 @@
1
- inherit_from:
2
- - https://raw.githubusercontent.com/trailblazer/meta/master/rubocop.yml
3
-
4
- AllCops:
5
- TargetRubyVersion: 2.5
6
- Exclude:
7
- - 'test/hash/bla.rb'
8
-
9
- Metrics/LineLength:
10
- Exclude:
11
- - test/diagram_test.rb
12
-
13
- Naming/MethodName:
14
- Enabled: false
15
-
16
- Style/ClassAndModuleChildren:
17
- Enabled: false
18
-
19
- # DISCUSS: user map instead of collect
20
- Style/CollectionMethods:
21
- Enabled: false
22
-
23
- # DISCUSS: Use raise with an explicit exception class and message, rather than just a message
24
- Style/ImplicitRuntimeError:
25
- Enabled: false
26
-
27
- Style/Lambda:
28
- EnforcedStyle: literal
29
-
30
- # DISCUSS: Use fail instead of raise to signal exceptions
31
- Style/SignalException:
32
- Enabled: false
33
-
34
- # DISUSS: this could be false because we have if locals blabla
35
- Bundler/DuplicatedGem:
36
- Enabled: false