burner 1.0.0.pre.alpha.1 → 1.0.0.pre.alpha.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -20
  3. data/burner.gemspec +3 -0
  4. data/exe/burner +3 -4
  5. data/lib/burner.rb +12 -0
  6. data/lib/burner/cli.rb +10 -8
  7. data/lib/burner/job.rb +28 -6
  8. data/lib/burner/jobs.rb +21 -23
  9. data/lib/burner/library.rb +30 -0
  10. data/lib/burner/library/collection/arrays_to_objects.rb +77 -0
  11. data/lib/burner/library/collection/graph.rb +44 -0
  12. data/lib/burner/library/collection/objects_to_arrays.rb +90 -0
  13. data/lib/burner/library/collection/shift.rb +44 -0
  14. data/lib/burner/library/collection/transform.rb +68 -0
  15. data/lib/burner/library/collection/unpivot.rb +47 -0
  16. data/lib/burner/library/collection/values.rb +51 -0
  17. data/lib/burner/library/deserialize/csv.rb +29 -0
  18. data/lib/burner/{jobs → library}/deserialize/json.rb +5 -2
  19. data/lib/burner/{jobs → library}/deserialize/yaml.rb +9 -3
  20. data/lib/burner/{jobs → library}/dummy.rb +4 -2
  21. data/lib/burner/{jobs → library}/echo.rb +5 -3
  22. data/lib/burner/{jobs → library}/io/base.rb +1 -7
  23. data/lib/burner/{jobs → library}/io/exist.rb +5 -3
  24. data/lib/burner/{jobs → library}/io/read.rb +6 -3
  25. data/lib/burner/{jobs → library}/io/write.rb +9 -4
  26. data/lib/burner/library/serialize/csv.rb +39 -0
  27. data/lib/burner/{jobs → library}/serialize/json.rb +5 -2
  28. data/lib/burner/{jobs → library}/serialize/yaml.rb +5 -2
  29. data/lib/burner/{jobs/set.rb → library/set_value.rb} +6 -3
  30. data/lib/burner/{jobs → library}/sleep.rb +4 -2
  31. data/lib/burner/modeling.rb +12 -0
  32. data/lib/burner/modeling/attribute.rb +29 -0
  33. data/lib/burner/modeling/attribute_renderer.rb +32 -0
  34. data/lib/burner/modeling/key_index_mapping.rb +29 -0
  35. data/lib/burner/payload.rb +20 -9
  36. data/lib/burner/pipeline.rb +23 -4
  37. data/lib/burner/side_effects.rb +10 -0
  38. data/lib/burner/side_effects/written_file.rb +28 -0
  39. data/lib/burner/step.rb +2 -4
  40. data/lib/burner/string_template.rb +6 -5
  41. data/lib/burner/util.rb +10 -0
  42. data/lib/burner/util/arrayable.rb +30 -0
  43. data/lib/burner/version.rb +1 -1
  44. metadata +74 -15
  45. data/lib/burner/written_file.rb +0 -28
@@ -0,0 +1,10 @@
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
+ require_relative 'side_effects/written_file'
@@ -0,0 +1,28 @@
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 SideEffects
12
+ # Describes a file that was generated by a Job. If a Job emits a file, it should also add the
13
+ # file details to the Payload#side_effects array using the Payload#add_side_effect method.
14
+ class WrittenFile
15
+ attr_reader :logical_filename,
16
+ :physical_filename,
17
+ :time_in_seconds
18
+
19
+ def initialize(logical_filename:, physical_filename:, time_in_seconds:)
20
+ @logical_filename = logical_filename.to_s
21
+ @physical_filename = physical_filename.to_s
22
+ @time_in_seconds = time_in_seconds.to_f
23
+
24
+ freeze
25
+ end
26
+ end
27
+ end
28
+ end
@@ -28,15 +28,13 @@ module Burner
28
28
  freeze
29
29
  end
30
30
 
31
- def perform(output, payload, params)
31
+ def perform(output, payload)
32
32
  return_value = nil
33
33
 
34
34
  output.title("#{job.class.name}#{SEPARATOR}#{job.name}")
35
35
 
36
36
  time_in_seconds = Benchmark.measure do
37
- job_params = (params || {}).merge(__id: output.id, __value: payload.value)
38
-
39
- return_value = job.perform(output, payload, job_params)
37
+ return_value = job.perform(output, payload)
40
38
  end.real.round(3)
41
39
 
42
40
  output.complete(time_in_seconds)
@@ -9,10 +9,11 @@
9
9
 
10
10
  module Burner
11
11
  # Can take in a string and an object and use the object for formatting string interpolations
12
- # using tokens of form: {attribute_name}. It can also understand dot-notation for nested
13
- # objects using the Objectable library. Another benefit of using Objectable for resolution
14
- # is that it can understand almost any type of object: Hash, Struct, OpenStruct, custom
15
- # objects, etc. For more information see underlying libraries:
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:
16
17
  # * Stringento: https://github.com/bluemarblepayroll/stringento
17
18
  # * Objectable: https://github.com/bluemarblepayroll/objectable
18
19
  class StringTemplate
@@ -21,7 +22,7 @@ module Burner
21
22
  attr_reader :resolver
22
23
 
23
24
  def initialize
24
- @resolver = Objectable.resolver
25
+ @resolver = Objectable.resolver(separator: '')
25
26
 
26
27
  freeze
27
28
  end
@@ -0,0 +1,10 @@
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
+ require_relative 'util/arrayable'
@@ -0,0 +1,30 @@
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
+ # Provide helper methods for dealing with Arrays.
13
+ module Arrayable
14
+ # Since Ruby's Kernel#Array will properly call #to_a for scalar Hash objects, this could
15
+ # return something funky in the context of this library. In this library, Hash instances
16
+ # are typically viewed as an atomic key-value-based "object". This library likes to deal
17
+ # with object-like things, treating Hash, OpenStruct, Struct, or Object subclasses as
18
+ # basically the same thing. In this vein, this library leverages Objectable to help
19
+ # unify access data from objects. See the Objectable library for more information:
20
+ # https://github.com/bluemarblepayroll/objectable
21
+ def array(value)
22
+ if value.is_a?(Hash)
23
+ [value]
24
+ else
25
+ Array(value)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Burner
11
- VERSION = '1.0.0-alpha.1'
11
+ VERSION = '1.0.0-alpha.6'
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.1
4
+ version: 1.0.0.pre.alpha.6
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-14 00:00:00.000000000 Z
11
+ date: 2020-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_hashable
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: hashematics
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: hash_math
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.2'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: objectable
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +66,20 @@ dependencies:
38
66
  - - "~>"
39
67
  - !ruby/object:Gem::Version
40
68
  version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: realize
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.2'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.2'
41
83
  - !ruby/object:Gem::Dependency
42
84
  name: stringento
43
85
  requirement: !ruby/object:Gem::Requirement
@@ -179,25 +221,42 @@ files:
179
221
  - lib/burner/cli.rb
180
222
  - lib/burner/job.rb
181
223
  - lib/burner/jobs.rb
182
- - lib/burner/jobs/deserialize/json.rb
183
- - lib/burner/jobs/deserialize/yaml.rb
184
- - lib/burner/jobs/dummy.rb
185
- - lib/burner/jobs/echo.rb
186
- - lib/burner/jobs/io/base.rb
187
- - lib/burner/jobs/io/exist.rb
188
- - lib/burner/jobs/io/read.rb
189
- - lib/burner/jobs/io/write.rb
190
- - lib/burner/jobs/serialize/json.rb
191
- - lib/burner/jobs/serialize/yaml.rb
192
- - lib/burner/jobs/set.rb
193
- - lib/burner/jobs/sleep.rb
224
+ - lib/burner/library.rb
225
+ - lib/burner/library/collection/arrays_to_objects.rb
226
+ - lib/burner/library/collection/graph.rb
227
+ - lib/burner/library/collection/objects_to_arrays.rb
228
+ - lib/burner/library/collection/shift.rb
229
+ - lib/burner/library/collection/transform.rb
230
+ - lib/burner/library/collection/unpivot.rb
231
+ - lib/burner/library/collection/values.rb
232
+ - lib/burner/library/deserialize/csv.rb
233
+ - lib/burner/library/deserialize/json.rb
234
+ - lib/burner/library/deserialize/yaml.rb
235
+ - lib/burner/library/dummy.rb
236
+ - lib/burner/library/echo.rb
237
+ - lib/burner/library/io/base.rb
238
+ - lib/burner/library/io/exist.rb
239
+ - lib/burner/library/io/read.rb
240
+ - lib/burner/library/io/write.rb
241
+ - lib/burner/library/serialize/csv.rb
242
+ - lib/burner/library/serialize/json.rb
243
+ - lib/burner/library/serialize/yaml.rb
244
+ - lib/burner/library/set_value.rb
245
+ - lib/burner/library/sleep.rb
246
+ - lib/burner/modeling.rb
247
+ - lib/burner/modeling/attribute.rb
248
+ - lib/burner/modeling/attribute_renderer.rb
249
+ - lib/burner/modeling/key_index_mapping.rb
194
250
  - lib/burner/output.rb
195
251
  - lib/burner/payload.rb
196
252
  - lib/burner/pipeline.rb
253
+ - lib/burner/side_effects.rb
254
+ - lib/burner/side_effects/written_file.rb
197
255
  - lib/burner/step.rb
198
256
  - lib/burner/string_template.rb
257
+ - lib/burner/util.rb
258
+ - lib/burner/util/arrayable.rb
199
259
  - lib/burner/version.rb
200
- - lib/burner/written_file.rb
201
260
  homepage: https://github.com/bluemarblepayroll/burner
202
261
  licenses:
203
262
  - MIT
@@ -1,28 +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
- # Describes a file that was generated by a Job. If a Job emits a file, it should also add the
12
- # file details to the Payload#written_files array using the Payload#add_written_file method.
13
- class WrittenFile
14
- acts_as_hashable
15
-
16
- attr_reader :logical_filename,
17
- :physical_filename,
18
- :time_in_seconds
19
-
20
- def initialize(logical_filename:, physical_filename:, time_in_seconds:)
21
- @logical_filename = logical_filename.to_s
22
- @physical_filename = physical_filename.to_s
23
- @time_in_seconds = time_in_seconds.to_f
24
-
25
- freeze
26
- end
27
- end
28
- end