burner 1.0.0.pre.alpha.3 → 1.0.0.pre.alpha.8
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 +4 -4
- data/.rubocop.yml +2 -0
- data/README.md +76 -44
- data/burner.gemspec +4 -1
- data/exe/burner +2 -3
- data/lib/burner.rb +11 -0
- data/lib/burner/cli.rb +10 -10
- data/lib/burner/job.rb +29 -9
- data/lib/burner/job_with_register.rb +24 -0
- data/lib/burner/jobs.rb +27 -23
- data/lib/burner/library.rb +32 -0
- data/lib/burner/library/collection/arrays_to_objects.rb +75 -0
- data/lib/burner/library/collection/graph.rb +42 -0
- data/lib/burner/library/collection/objects_to_arrays.rb +88 -0
- data/lib/burner/library/collection/shift.rb +42 -0
- data/lib/burner/library/collection/transform.rb +66 -0
- data/lib/burner/library/collection/unpivot.rb +53 -0
- data/lib/burner/library/collection/validate.rb +89 -0
- data/lib/burner/library/collection/values.rb +49 -0
- data/lib/burner/library/deserialize/csv.rb +27 -0
- data/lib/burner/{jobs → library}/deserialize/json.rb +7 -6
- data/lib/burner/{jobs → library}/deserialize/yaml.rb +14 -8
- data/lib/burner/{jobs → library}/dummy.rb +4 -4
- data/lib/burner/{jobs → library}/echo.rb +5 -5
- data/lib/burner/{jobs → library}/io/base.rb +4 -10
- data/lib/burner/{jobs → library}/io/exist.rb +13 -11
- data/lib/burner/{jobs → library}/io/read.rb +9 -8
- data/lib/burner/{jobs → library}/io/write.rb +11 -8
- data/lib/burner/library/serialize/csv.rb +37 -0
- data/lib/burner/{jobs → library}/serialize/json.rb +7 -6
- data/lib/burner/{jobs → library}/serialize/yaml.rb +7 -6
- data/lib/burner/{jobs/set.rb → library/set_value.rb} +9 -8
- data/lib/burner/{jobs → library}/sleep.rb +4 -4
- data/lib/burner/modeling.rb +13 -0
- data/lib/burner/modeling/attribute.rb +29 -0
- data/lib/burner/modeling/attribute_renderer.rb +32 -0
- data/lib/burner/modeling/key_index_mapping.rb +29 -0
- data/lib/burner/modeling/validations.rb +23 -0
- data/lib/burner/modeling/validations/base.rb +35 -0
- data/lib/burner/modeling/validations/blank.rb +31 -0
- data/lib/burner/modeling/validations/present.rb +31 -0
- data/lib/burner/payload.rb +55 -10
- data/lib/burner/pipeline.rb +25 -6
- data/lib/burner/side_effects.rb +10 -0
- data/lib/burner/side_effects/written_file.rb +28 -0
- data/lib/burner/step.rb +2 -8
- data/lib/burner/util.rb +11 -0
- data/lib/burner/util/arrayable.rb +30 -0
- data/lib/burner/util/string_template.rb +42 -0
- data/lib/burner/version.rb +1 -1
- metadata +84 -18
- data/lib/burner/string_template.rb +0 -40
- 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
|
data/lib/burner/step.rb
CHANGED
@@ -28,20 +28,14 @@ module Burner
|
|
28
28
|
freeze
|
29
29
|
end
|
30
30
|
|
31
|
-
def perform(output, payload
|
32
|
-
return_value = nil
|
33
|
-
|
31
|
+
def perform(output, payload)
|
34
32
|
output.title("#{job.class.name}#{SEPARATOR}#{job.name}")
|
35
33
|
|
36
34
|
time_in_seconds = Benchmark.measure do
|
37
|
-
|
38
|
-
|
39
|
-
return_value = job.perform(output, payload, job_params)
|
35
|
+
job.perform(output, payload)
|
40
36
|
end.real.round(3)
|
41
37
|
|
42
38
|
output.complete(time_in_seconds)
|
43
|
-
|
44
|
-
return_value
|
45
39
|
end
|
46
40
|
end
|
47
41
|
end
|
data/lib/burner/util.rb
ADDED
@@ -0,0 +1,11 @@
|
|
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'
|
11
|
+
require_relative 'util/string_template'
|
@@ -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
|
@@ -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
|
data/lib/burner/version.rb
CHANGED
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.
|
4
|
+
version: 1.0.0.pre.alpha.8
|
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-
|
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
|
@@ -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
|
@@ -150,8 +192,9 @@ dependencies:
|
|
150
192
|
- - "~>"
|
151
193
|
- !ruby/object:Gem::Version
|
152
194
|
version: 0.7.0
|
153
|
-
description: " This library serves as the
|
154
|
-
allows you to organize your code into
|
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"
|
155
198
|
email:
|
156
199
|
- mruggio@bluemarblepayroll.com
|
157
200
|
executables:
|
@@ -178,26 +221,49 @@ files:
|
|
178
221
|
- lib/burner.rb
|
179
222
|
- lib/burner/cli.rb
|
180
223
|
- lib/burner/job.rb
|
224
|
+
- lib/burner/job_with_register.rb
|
181
225
|
- lib/burner/jobs.rb
|
182
|
-
- lib/burner/
|
183
|
-
- lib/burner/
|
184
|
-
- lib/burner/
|
185
|
-
- lib/burner/
|
186
|
-
- lib/burner/
|
187
|
-
- lib/burner/
|
188
|
-
- lib/burner/
|
189
|
-
- lib/burner/
|
190
|
-
- lib/burner/
|
191
|
-
- lib/burner/
|
192
|
-
- lib/burner/
|
193
|
-
- lib/burner/
|
226
|
+
- lib/burner/library.rb
|
227
|
+
- lib/burner/library/collection/arrays_to_objects.rb
|
228
|
+
- lib/burner/library/collection/graph.rb
|
229
|
+
- lib/burner/library/collection/objects_to_arrays.rb
|
230
|
+
- lib/burner/library/collection/shift.rb
|
231
|
+
- lib/burner/library/collection/transform.rb
|
232
|
+
- lib/burner/library/collection/unpivot.rb
|
233
|
+
- lib/burner/library/collection/validate.rb
|
234
|
+
- lib/burner/library/collection/values.rb
|
235
|
+
- lib/burner/library/deserialize/csv.rb
|
236
|
+
- lib/burner/library/deserialize/json.rb
|
237
|
+
- lib/burner/library/deserialize/yaml.rb
|
238
|
+
- lib/burner/library/dummy.rb
|
239
|
+
- lib/burner/library/echo.rb
|
240
|
+
- lib/burner/library/io/base.rb
|
241
|
+
- lib/burner/library/io/exist.rb
|
242
|
+
- lib/burner/library/io/read.rb
|
243
|
+
- lib/burner/library/io/write.rb
|
244
|
+
- lib/burner/library/serialize/csv.rb
|
245
|
+
- lib/burner/library/serialize/json.rb
|
246
|
+
- lib/burner/library/serialize/yaml.rb
|
247
|
+
- lib/burner/library/set_value.rb
|
248
|
+
- lib/burner/library/sleep.rb
|
249
|
+
- lib/burner/modeling.rb
|
250
|
+
- lib/burner/modeling/attribute.rb
|
251
|
+
- lib/burner/modeling/attribute_renderer.rb
|
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
|
194
257
|
- lib/burner/output.rb
|
195
258
|
- lib/burner/payload.rb
|
196
259
|
- lib/burner/pipeline.rb
|
260
|
+
- lib/burner/side_effects.rb
|
261
|
+
- lib/burner/side_effects/written_file.rb
|
197
262
|
- lib/burner/step.rb
|
198
|
-
- lib/burner/
|
263
|
+
- lib/burner/util.rb
|
264
|
+
- lib/burner/util/arrayable.rb
|
265
|
+
- lib/burner/util/string_template.rb
|
199
266
|
- lib/burner/version.rb
|
200
|
-
- lib/burner/written_file.rb
|
201
267
|
homepage: https://github.com/bluemarblepayroll/burner
|
202
268
|
licenses:
|
203
269
|
- MIT
|
@@ -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
|
data/lib/burner/written_file.rb
DELETED
@@ -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
|