etcher 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +31 -6
- data/etcher.gemspec +3 -3
- data/lib/etcher/builder.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +7 -7
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 765e913767d6c9d357ce121dc81ed86269abebeac8575e664c4becbc0043b21e
|
4
|
+
data.tar.gz: b16b6a76d818bbc560d615edcafba252ba42471cfa5ba1d1fc83375f37e75086
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70aa7039b3fabaf0b2164cc9a8c7d06a6721377ac3ba3f6b4d82e586f5fd6fd24f32d48f44ebe05b5565a624e0b1d0c00411319045638c2dabc79999d937c7e5
|
7
|
+
data.tar.gz: bd628b9a423ce9df42ba5f388214989e6692c09b5273975f3231b3081df47de4d1d024e9e345d939777c4f903c2b39cd1f8ddf35cfab2e8cb85d43ef814de3d3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -33,11 +33,11 @@ toc::[]
|
|
33
33
|
|
34
34
|
== Features
|
35
35
|
|
36
|
-
* Supports contracts which respond to `#call` to validate a {hash_link} before building the final record. This
|
37
|
-
* Supports models which respond to `.[]` for consuming a splatted {hash_link} to instantiate new records. This
|
36
|
+
* Supports contracts which respond to `#call` to validate a {hash_link} before building the final record. This pairs well with the {dry_schema_link} and {dry_validation_link} gems.
|
37
|
+
* Supports models which respond to `.[]` for consuming a splatted {hash_link} to instantiate new records. This pairs well with primitives such as: {hash_link}, {data_link}, and {struct_link}.
|
38
38
|
* Supports loading of default configurations from the {environment_link}, a {json_link} configuration, a {yaml_link} configuration, or anything that can answer a hash.
|
39
39
|
* Supports multiple transformations which can process loaded configuration hashes and answer a transformed hash.
|
40
|
-
* Supports {hash_link} overrides as a final customization which is handy for Command Line Interfaces (
|
40
|
+
* Supports {hash_link} overrides as a final customization which is handy for Command Line Interfaces (CLIs) or anything that might require user input at runtime.
|
41
41
|
|
42
42
|
== Requirements
|
43
43
|
|
@@ -120,6 +120,8 @@ The above can be broken down into a series of steps:
|
|
120
120
|
|
121
121
|
While this is a more advanced use case, you'll usually only need to register a contract and model. The loaders and transformers provide additional firepower in situations where you need to do more with your data. We'll look at each of these components in greater detail next.
|
122
122
|
|
123
|
+
ℹ️ All keys are converted to symbols before being processed. This is done to ensure consistency and improve debugablity when dealing with raw input that might be a mix of strings and/or symbols.
|
124
|
+
|
123
125
|
=== Registry
|
124
126
|
|
125
127
|
The registry is provided as a way to register any/all complexity for before creating a new Etcher instance. Here's what you get by default:
|
@@ -155,7 +157,7 @@ registry = Etcher::Registry.new
|
|
155
157
|
|
156
158
|
=== Contracts
|
157
159
|
|
158
|
-
Contracts are critical piece of this workflow as they provide a way to validate incoming data,
|
160
|
+
Contracts are critical piece of this workflow as they provide a way to validate incoming data, remove unwanted data, and create a sanitized record for use in your application. Any contract that has the following behavior will work:
|
159
161
|
|
160
162
|
* `#call`: Must be able to consume a {hash_link} and answer an object which can respond to `#to_monad`.
|
161
163
|
|
@@ -240,7 +242,18 @@ Notice we get an failure if all attributes are not provided but if we supply the
|
|
240
242
|
|
241
243
|
=== Loaders
|
242
244
|
|
243
|
-
Loaders are a great way to load _default_ configuration information for your application which can be in multiple formats.
|
245
|
+
Loaders are a great way to load _default_ configuration information for your application which can be in multiple formats. Loaders can either be defined when creating a new registry instance or added after the fact. Here are a few examples:
|
246
|
+
|
247
|
+
[source,ruby]
|
248
|
+
----
|
249
|
+
# Initializer
|
250
|
+
registry = Etcher::Registry[loaders: [MyLoader.new]]
|
251
|
+
|
252
|
+
# Method
|
253
|
+
registry = Etcher::Registry.new.add_loader MyLoader.new
|
254
|
+
----
|
255
|
+
|
256
|
+
There are a few guidelines to using them:
|
244
257
|
|
245
258
|
* They must respond to `#call` with no arguments.
|
246
259
|
* All keys are symbolized which helps streamline merging and overriding values from the same keys across multiple configurations.
|
@@ -353,10 +366,22 @@ While the above isn't super useful since it only answers whatever you provide as
|
|
353
366
|
|
354
367
|
=== Transformers
|
355
368
|
|
356
|
-
Transformers are great for modifying specific keys and values. They give you finer grained control over your configuration and are the last step before validating and creating an associated record of your configuration.
|
369
|
+
Transformers are great for modifying specific keys and values. They give you finer grained control over your configuration and are the last step before validating and creating an associated record of your configuration. Transformers can either be defined when creating a new registry instance or added after the fact. Here are a few examples:
|
370
|
+
|
371
|
+
[source,ruby]
|
372
|
+
----
|
373
|
+
# Initializer
|
374
|
+
registry = Etcher::Registry[transformers: [MyTransformer]]
|
375
|
+
|
376
|
+
# Method
|
377
|
+
registry = Etcher::Registry.new.add_transformer MyTransformer
|
378
|
+
----
|
379
|
+
|
380
|
+
Here are a few guidelines to using them:
|
357
381
|
|
358
382
|
* They can be initialized with whatever requirements you might need.
|
359
383
|
* They must respond to `#call` which takes a single argument (i.e. `content`) and answers a modified representation of this content as a `Success` with a `Hash` for content.
|
384
|
+
* The `content` passed to your transformer will have symbolized keys.
|
360
385
|
|
361
386
|
Here are a few examples of where you could go with this:
|
362
387
|
|
data/etcher.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "etcher"
|
5
|
-
spec.version = "0.
|
5
|
+
spec.version = "0.2.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/etcher"
|
@@ -23,11 +23,11 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.cert_chain = [Gem.default_cert_path]
|
24
24
|
|
25
25
|
spec.required_ruby_version = "~> 3.2"
|
26
|
-
spec.add_dependency "cogger", "~> 0.
|
26
|
+
spec.add_dependency "cogger", "~> 0.10"
|
27
27
|
spec.add_dependency "core", "~> 0.1"
|
28
28
|
spec.add_dependency "dry-monads", "~> 1.6"
|
29
29
|
spec.add_dependency "dry-types", "~> 1.7"
|
30
|
-
spec.add_dependency "refinements", "~>
|
30
|
+
spec.add_dependency "refinements", "~> 11.0"
|
31
31
|
spec.add_dependency "zeitwerk", "~> 2.6"
|
32
32
|
|
33
33
|
spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
|
data/lib/etcher/builder.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
|
36
36
|
gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2023-
|
38
|
+
date: 2023-06-13 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: cogger
|
@@ -43,14 +43,14 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
46
|
+
version: '0.10'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.10'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: core
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,14 +99,14 @@ dependencies:
|
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
102
|
+
version: '11.0'
|
103
103
|
type: :runtime
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '11.0'
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: zeitwerk
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
|
-
rubygems_version: 3.4.
|
171
|
+
rubygems_version: 3.4.14
|
172
172
|
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: A monadic configuration loader, transformer, and validator.
|
metadata.gz.sig
CHANGED
Binary file
|