burner 1.0.0.pre.alpha.6 → 1.0.0.pre.alpha.11

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/README.md +43 -39
  4. data/burner.gemspec +1 -1
  5. data/lib/burner/job.rb +15 -10
  6. data/lib/burner/job_with_register.rb +24 -0
  7. data/lib/burner/jobs.rb +27 -20
  8. data/lib/burner/library.rb +11 -5
  9. data/lib/burner/library/collection/arrays_to_objects.rb +14 -11
  10. data/lib/burner/library/collection/graph.rb +7 -9
  11. data/lib/burner/library/collection/objects_to_arrays.rb +34 -34
  12. data/lib/burner/library/collection/shift.rb +6 -8
  13. data/lib/burner/library/collection/transform.rb +7 -9
  14. data/lib/burner/library/collection/unpivot.rb +17 -11
  15. data/lib/burner/library/collection/validate.rb +90 -0
  16. data/lib/burner/library/collection/values.rb +9 -11
  17. data/lib/burner/library/deserialize/csv.rb +4 -6
  18. data/lib/burner/library/deserialize/json.rb +4 -6
  19. data/lib/burner/library/deserialize/yaml.rb +7 -7
  20. data/lib/burner/library/echo.rb +1 -3
  21. data/lib/burner/library/io/base.rb +3 -3
  22. data/lib/burner/library/io/exist.rb +9 -9
  23. data/lib/burner/library/io/read.rb +5 -7
  24. data/lib/burner/library/io/write.rb +5 -7
  25. data/lib/burner/library/{dummy.rb → nothing.rb} +3 -5
  26. data/lib/burner/library/serialize/csv.rb +5 -7
  27. data/lib/burner/library/serialize/json.rb +4 -6
  28. data/lib/burner/library/serialize/yaml.rb +4 -6
  29. data/lib/burner/library/set_value.rb +6 -8
  30. data/lib/burner/library/sleep.rb +1 -3
  31. data/lib/burner/modeling.rb +1 -0
  32. data/lib/burner/modeling/attribute.rb +3 -1
  33. data/lib/burner/modeling/validations.rb +23 -0
  34. data/lib/burner/modeling/validations/base.rb +35 -0
  35. data/lib/burner/modeling/validations/blank.rb +31 -0
  36. data/lib/burner/modeling/validations/present.rb +31 -0
  37. data/lib/burner/payload.rb +50 -10
  38. data/lib/burner/pipeline.rb +3 -3
  39. data/lib/burner/step.rb +1 -5
  40. data/lib/burner/util.rb +1 -0
  41. data/lib/burner/util/string_template.rb +42 -0
  42. data/lib/burner/version.rb +1 -1
  43. metadata +13 -6
  44. data/lib/burner/string_template.rb +0 -40
@@ -48,10 +48,10 @@ module Burner
48
48
 
49
49
  time_in_seconds = Benchmark.measure do
50
50
  steps.each do |step|
51
- return_value = step.perform(output, payload)
51
+ step.perform(output, payload)
52
52
 
53
- if return_value.is_a?(FalseClass)
54
- output.detail('Job returned false, ending pipeline.')
53
+ if payload.halt_pipeline?
54
+ output.detail('Payload was halted, ending pipeline.')
55
55
  break
56
56
  end
57
57
  end
@@ -29,17 +29,13 @@ module Burner
29
29
  end
30
30
 
31
31
  def perform(output, payload)
32
- return_value = nil
33
-
34
32
  output.title("#{job.class.name}#{SEPARATOR}#{job.name}")
35
33
 
36
34
  time_in_seconds = Benchmark.measure do
37
- return_value = job.perform(output, payload)
35
+ job.perform(output, payload)
38
36
  end.real.round(3)
39
37
 
40
38
  output.complete(time_in_seconds)
41
-
42
- return_value
43
39
  end
44
40
  end
45
41
  end
@@ -8,3 +8,4 @@
8
8
  #
9
9
 
10
10
  require_relative 'util/arrayable'
11
+ require_relative 'util/string_template'
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
+ #
6
+ # This source code is licensed under the MIT license found in the
7
+ # LICENSE file in the root directory of this source tree.
8
+ #
9
+
10
+ module Burner
11
+ module Util
12
+ # Can take in a string and an object and use the object for formatting string interpolations
13
+ # using tokens of form: {attribute_name}. This templating class does not understand nested
14
+ # structures, so input should be a flat object/hash in the form of key-value pairs.
15
+ # A benefit of using Objectable for resolution is that it can understand almost any type of
16
+ # object: Hash, Struct, OpenStruct, custom objects, etc.
17
+ # For more information see underlying libraries:
18
+ # * Stringento: https://github.com/bluemarblepayroll/stringento
19
+ # * Objectable: https://github.com/bluemarblepayroll/objectable
20
+ class StringTemplate
21
+ include Singleton
22
+
23
+ attr_reader :resolver
24
+
25
+ def initialize
26
+ @resolver = Objectable.resolver(separator: '')
27
+
28
+ freeze
29
+ end
30
+
31
+ # For general consumption
32
+ def evaluate(expression, input)
33
+ Stringento.evaluate(expression, input, resolver: self)
34
+ end
35
+
36
+ # For Stringento consumption
37
+ def resolve(value, input)
38
+ resolver.get(input, value)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Burner
11
- VERSION = '1.0.0-alpha.6'
11
+ VERSION = '1.0.0-alpha.11'
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: burner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.alpha.6
4
+ version: 1.0.0.pre.alpha.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-22 00:00:00.000000000 Z
11
+ date: 2020-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_hashable
@@ -192,8 +192,9 @@ dependencies:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
194
  version: 0.7.0
195
- description: " This library serves as the skeleton for a processing engine. It
196
- allows you to organize your code into Jobs, then stitch those jobs together as steps.\n"
195
+ description: " This library serves as the backbone for a configurable processing
196
+ engine. It allows you to organize your code into jobs, then stitch those jobs together
197
+ as steps.\n"
197
198
  email:
198
199
  - mruggio@bluemarblepayroll.com
199
200
  executables:
@@ -220,6 +221,7 @@ files:
220
221
  - lib/burner.rb
221
222
  - lib/burner/cli.rb
222
223
  - lib/burner/job.rb
224
+ - lib/burner/job_with_register.rb
223
225
  - lib/burner/jobs.rb
224
226
  - lib/burner/library.rb
225
227
  - lib/burner/library/collection/arrays_to_objects.rb
@@ -228,16 +230,17 @@ files:
228
230
  - lib/burner/library/collection/shift.rb
229
231
  - lib/burner/library/collection/transform.rb
230
232
  - lib/burner/library/collection/unpivot.rb
233
+ - lib/burner/library/collection/validate.rb
231
234
  - lib/burner/library/collection/values.rb
232
235
  - lib/burner/library/deserialize/csv.rb
233
236
  - lib/burner/library/deserialize/json.rb
234
237
  - lib/burner/library/deserialize/yaml.rb
235
- - lib/burner/library/dummy.rb
236
238
  - lib/burner/library/echo.rb
237
239
  - lib/burner/library/io/base.rb
238
240
  - lib/burner/library/io/exist.rb
239
241
  - lib/burner/library/io/read.rb
240
242
  - lib/burner/library/io/write.rb
243
+ - lib/burner/library/nothing.rb
241
244
  - lib/burner/library/serialize/csv.rb
242
245
  - lib/burner/library/serialize/json.rb
243
246
  - lib/burner/library/serialize/yaml.rb
@@ -247,15 +250,19 @@ files:
247
250
  - lib/burner/modeling/attribute.rb
248
251
  - lib/burner/modeling/attribute_renderer.rb
249
252
  - lib/burner/modeling/key_index_mapping.rb
253
+ - lib/burner/modeling/validations.rb
254
+ - lib/burner/modeling/validations/base.rb
255
+ - lib/burner/modeling/validations/blank.rb
256
+ - lib/burner/modeling/validations/present.rb
250
257
  - lib/burner/output.rb
251
258
  - lib/burner/payload.rb
252
259
  - lib/burner/pipeline.rb
253
260
  - lib/burner/side_effects.rb
254
261
  - lib/burner/side_effects/written_file.rb
255
262
  - lib/burner/step.rb
256
- - lib/burner/string_template.rb
257
263
  - lib/burner/util.rb
258
264
  - lib/burner/util/arrayable.rb
265
+ - lib/burner/util/string_template.rb
259
266
  - lib/burner/version.rb
260
267
  homepage: https://github.com/bluemarblepayroll/burner
261
268
  licenses:
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #
4
- # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
- #
6
- # This source code is licensed under the MIT license found in the
7
- # LICENSE file in the root directory of this source tree.
8
- #
9
-
10
- module Burner
11
- # Can take in a string and an object and use the object for formatting string interpolations
12
- # using tokens of form: {attribute_name}. This templating class does not understand nested
13
- # structures, so input should be a flat object/hash in the form of key-value pairs. A benefit of
14
- # using Objectable for resolution is that it can understand almost any type of
15
- # object: Hash, Struct, OpenStruct, custom objects, etc.
16
- # For more information see underlying libraries:
17
- # * Stringento: https://github.com/bluemarblepayroll/stringento
18
- # * Objectable: https://github.com/bluemarblepayroll/objectable
19
- class StringTemplate
20
- include Singleton
21
-
22
- attr_reader :resolver
23
-
24
- def initialize
25
- @resolver = Objectable.resolver(separator: '')
26
-
27
- freeze
28
- end
29
-
30
- # For general consumption
31
- def evaluate(expression, input)
32
- Stringento.evaluate(expression, input, resolver: self)
33
- end
34
-
35
- # For Stringento consumption
36
- def resolve(value, input)
37
- resolver.get(input, value)
38
- end
39
- end
40
- end