burner 1.0.0.pre.alpha.13 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/burner.gemspec +1 -1
- data/lib/burner.rb +6 -0
- data/lib/burner/job_with_register.rb +1 -1
- data/lib/burner/library/collection/arrays_to_objects.rb +1 -1
- data/lib/burner/library/collection/concatenate.rb +1 -1
- data/lib/burner/library/collection/graph.rb +5 -1
- data/lib/burner/library/collection/objects_to_arrays.rb +1 -1
- data/lib/burner/library/collection/shift.rb +1 -1
- data/lib/burner/library/collection/transform.rb +7 -1
- data/lib/burner/library/collection/unpivot.rb +5 -1
- data/lib/burner/library/collection/validate.rb +1 -1
- data/lib/burner/library/collection/values.rb +1 -1
- data/lib/burner/library/deserialize/yaml.rb +1 -1
- data/lib/burner/library/io/base.rb +1 -1
- data/lib/burner/library/io/read.rb +1 -1
- data/lib/burner/library/io/write.rb +1 -1
- data/lib/burner/library/value/copy.rb +2 -2
- data/lib/burner/library/value/static.rb +1 -1
- data/lib/burner/modeling/validations/base.rb +1 -1
- data/lib/burner/modeling/validations/blank.rb +6 -2
- data/lib/burner/modeling/validations/present.rb +4 -4
- data/lib/burner/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3d251463ade2de965d0dd1e0d635967571d3d1d4cab46a7d1271ab057d1c2e3
|
4
|
+
data.tar.gz: 2eac66d3f745888be07cf5d2d66f6e8429c61b0255ad0916f7c6f8c792194dcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c57dabbc95d1b58b5f0fe15429f36682d0dec0771951bb01b6e8c6345ddd9e95b5805ad57f0e0166e8e4e87d0296885915c022895818e46c3389049207e0e719
|
7
|
+
data.tar.gz: f23ecf1374570ad2f5cc6dfb70c88c895e4d45e0c2eb7453878038dc507d1a808ca3894c50a320b4a259df09ad7f1368a4b8c7bd790624b27baac487df1b48cf
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -278,6 +278,8 @@ Notes:
|
|
278
278
|
|
279
279
|
### Adding & Registering Jobs
|
280
280
|
|
281
|
+
Note: Jobs have to be registered with a type in the Burner::Jobs factory. All jobs that ship with this library are prefixed with `b/` in their type in order to provide a namespace for 'burner-specific' jobs vs. externally provided jobs.
|
282
|
+
|
281
283
|
Where this library shines is when additional jobs are plugged in. Burner uses its `Burner::Jobs` class as its class-level registry built with [acts_as_hashable](https://github.com/bluemarblepayroll/acts_as_hashable)'s acts_as_hashable_factory directive.
|
282
284
|
|
283
285
|
Let's say we would like to register a job to parse a CSV:
|
data/burner.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.add_dependency('hashematics', '~>1.1')
|
33
33
|
s.add_dependency('hash_math', '~>1.2')
|
34
34
|
s.add_dependency('objectable', '~>1.0')
|
35
|
-
s.add_dependency('realize', '~>1.
|
35
|
+
s.add_dependency('realize', '~>1.3')
|
36
36
|
s.add_dependency('stringento', '~>2.1')
|
37
37
|
|
38
38
|
s.add_development_dependency('guard-rspec', '~>4.7')
|
data/lib/burner.rb
CHANGED
@@ -55,7 +55,7 @@ module Burner
|
|
55
55
|
class ArraysToObjects < JobWithRegister
|
56
56
|
attr_reader :mappings
|
57
57
|
|
58
|
-
def initialize(name:, mappings: [], register:
|
58
|
+
def initialize(name:, mappings: [], register: DEFAULT_REGISTER)
|
59
59
|
super(name: name, register: register)
|
60
60
|
|
61
61
|
@mappings = Modeling::KeyIndexMapping.array(mappings)
|
@@ -18,7 +18,7 @@ module Burner
|
|
18
18
|
class Concatenate < Job
|
19
19
|
attr_reader :from_registers, :to_register
|
20
20
|
|
21
|
-
def initialize(name:, from_registers: [], to_register:
|
21
|
+
def initialize(name:, from_registers: [], to_register: DEFAULT_REGISTER)
|
22
22
|
super(name: name)
|
23
23
|
|
24
24
|
@from_registers = Array(from_registers)
|
@@ -18,7 +18,11 @@ module Burner
|
|
18
18
|
class Graph < JobWithRegister
|
19
19
|
attr_reader :key, :groups
|
20
20
|
|
21
|
-
def initialize(
|
21
|
+
def initialize(
|
22
|
+
name:, key:,
|
23
|
+
config: Hashematics::Configuration.new,
|
24
|
+
register: DEFAULT_REGISTER
|
25
|
+
)
|
22
26
|
super(name: name, register: register)
|
23
27
|
|
24
28
|
raise ArgumentError, 'key is required' if key.to_s.empty?
|
@@ -58,7 +58,7 @@ module Burner
|
|
58
58
|
# nested hashes then set separator to '.'. For more information, see the underlying
|
59
59
|
# library that supports this dot-notation concept:
|
60
60
|
# https://github.com/bluemarblepayroll/objectable
|
61
|
-
def initialize(name:, mappings: [], register:
|
61
|
+
def initialize(name:, mappings: [], register: DEFAULT_REGISTER, separator: '')
|
62
62
|
super(name: name, register: register)
|
63
63
|
|
64
64
|
@mappings = Modeling::KeyIndexMapping.array(mappings)
|
@@ -27,7 +27,13 @@ module Burner
|
|
27
27
|
:exclusive,
|
28
28
|
:resolver
|
29
29
|
|
30
|
-
def initialize(
|
30
|
+
def initialize(
|
31
|
+
name:,
|
32
|
+
attributes: [],
|
33
|
+
exclusive: false,
|
34
|
+
register: DEFAULT_REGISTER,
|
35
|
+
separator: BLANK
|
36
|
+
)
|
31
37
|
super(name: name, register: register)
|
32
38
|
|
33
39
|
@resolver = Objectable.resolver(separator: separator)
|
@@ -19,7 +19,11 @@ module Burner
|
|
19
19
|
class Unpivot < JobWithRegister
|
20
20
|
attr_reader :unpivot
|
21
21
|
|
22
|
-
def initialize(
|
22
|
+
def initialize(
|
23
|
+
name:,
|
24
|
+
pivot_set: HashMath::Unpivot::PivotSet.new,
|
25
|
+
register: DEFAULT_REGISTER
|
26
|
+
)
|
23
27
|
super(name: name, register: register)
|
24
28
|
|
25
29
|
@unpivot = HashMath::Unpivot.new(pivot_set)
|
@@ -19,7 +19,7 @@ module Burner
|
|
19
19
|
class Values < JobWithRegister
|
20
20
|
attr_reader :include_keys
|
21
21
|
|
22
|
-
def initialize(name:, include_keys: false, register:
|
22
|
+
def initialize(name:, include_keys: false, register: DEFAULT_REGISTER)
|
23
23
|
super(name: name, register: register)
|
24
24
|
|
25
25
|
@include_keys = include_keys || false
|
@@ -14,7 +14,7 @@ module Burner
|
|
14
14
|
class Base < JobWithRegister
|
15
15
|
attr_reader :path
|
16
16
|
|
17
|
-
def initialize(name:, path:, register:
|
17
|
+
def initialize(name:, path:, register: DEFAULT_REGISTER)
|
18
18
|
super(name: name, register: register)
|
19
19
|
|
20
20
|
raise ArgumentError, 'path is required' if path.to_s.empty?
|
@@ -19,7 +19,7 @@ module Burner
|
|
19
19
|
class Read < Base
|
20
20
|
attr_reader :binary
|
21
21
|
|
22
|
-
def initialize(name:, path:, binary: false, register:
|
22
|
+
def initialize(name:, path:, binary: false, register: DEFAULT_REGISTER)
|
23
23
|
super(name: name, path: path, register: register)
|
24
24
|
|
25
25
|
@binary = binary || false
|
@@ -19,7 +19,7 @@ module Burner
|
|
19
19
|
class Write < Base
|
20
20
|
attr_reader :binary
|
21
21
|
|
22
|
-
def initialize(name:, path:, binary: false, register:
|
22
|
+
def initialize(name:, path:, binary: false, register: DEFAULT_REGISTER)
|
23
23
|
super(name: name, path: path, register: register)
|
24
24
|
|
25
25
|
@binary = binary || false
|
@@ -12,14 +12,14 @@ module Burner
|
|
12
12
|
module Value
|
13
13
|
# Copy one value in a register to another. Note that this does *not* perform any type of
|
14
14
|
# deep copy, it simply points one register's value to another. If you decide to later mutate
|
15
|
-
# one register
|
15
|
+
# one register then you may mutate the other.
|
16
16
|
#
|
17
17
|
# Expected Payload[from_register] input: anything.
|
18
18
|
# Payload[to_register] output: whatever value was specified in the from_register.
|
19
19
|
class Copy < Job
|
20
20
|
attr_reader :from_register, :to_register
|
21
21
|
|
22
|
-
def initialize(name:, to_register:
|
22
|
+
def initialize(name:, to_register: DEFAULT_REGISTER, from_register: DEFAULT_REGISTER)
|
23
23
|
super(name: name)
|
24
24
|
|
25
25
|
@from_register = from_register.to_s
|
@@ -16,14 +16,18 @@ module Burner
|
|
16
16
|
class Blank < Base
|
17
17
|
acts_as_hashable
|
18
18
|
|
19
|
+
BLANK_RE = /\A[[:space:]]*\z/.freeze
|
20
|
+
|
19
21
|
def valid?(object, resolver)
|
20
|
-
resolver.get(object, key).to_s
|
22
|
+
value = resolver.get(object, key).to_s
|
23
|
+
|
24
|
+
value.empty? || BLANK_RE.match?(value)
|
21
25
|
end
|
22
26
|
|
23
27
|
private
|
24
28
|
|
25
29
|
def default_message
|
26
|
-
'
|
30
|
+
'must be blank'
|
27
31
|
end
|
28
32
|
end
|
29
33
|
end
|
@@ -7,23 +7,23 @@
|
|
7
7
|
# LICENSE file in the root directory of this source tree.
|
8
8
|
#
|
9
9
|
|
10
|
-
require_relative '
|
10
|
+
require_relative 'blank'
|
11
11
|
|
12
12
|
module Burner
|
13
13
|
module Modeling
|
14
14
|
class Validations
|
15
15
|
# Check if a value is present. If it is blank (null or empty) then it is invalid.
|
16
|
-
class Present <
|
16
|
+
class Present < Blank
|
17
17
|
acts_as_hashable
|
18
18
|
|
19
19
|
def valid?(object_value, resolver)
|
20
|
-
!
|
20
|
+
!super(object_value, resolver)
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def default_message
|
26
|
-
'
|
26
|
+
'is required'
|
27
27
|
end
|
28
28
|
end
|
29
29
|
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
|
4
|
+
version: 1.0.0
|
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-
|
11
|
+
date: 2020-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts_as_hashable
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1.
|
75
|
+
version: '1.3'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
82
|
+
version: '1.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: stringento
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -286,9 +286,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
286
286
|
version: '2.5'
|
287
287
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
288
288
|
requirements:
|
289
|
-
- - "
|
289
|
+
- - ">="
|
290
290
|
- !ruby/object:Gem::Version
|
291
|
-
version:
|
291
|
+
version: '0'
|
292
292
|
requirements: []
|
293
293
|
rubygems_version: 3.0.3
|
294
294
|
signing_key:
|