etcher 0.2.1 → 0.3.0
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
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +35 -3
- data/etcher.gemspec +2 -1
- data/lib/etcher/types.rb +2 -0
- data.tar.gz.sig +0 -0
- metadata +17 -3
- 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: bdae8d6e407c3a6d7f9c43c79be0f97040996c4460f726976931a0a395c6f0c5
|
4
|
+
data.tar.gz: 0ff6f4e79245a0e14c4e7dc36672562b5ae7ea370dd9a9ce1dae0cc83ff950bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9cd8e067ab556f27a53804f18f389a41a3987f9e942dcfa471cfbc937fc4a2a353c3f6a0bf260daa91667906bdcd8e162d99133563a6386fa98c9e241f3174c
|
7
|
+
data.tar.gz: 5feeefaa7b6216791071572592d69e93fcbd5de940ff36713c68fec83e368fa53374ab42b780748c26b08c8acc283dbe03ef77c0d2a45cf0ca379a992754db38
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
:sod_link: link:https://alchemists.io/projects/sod[Sod]
|
18
18
|
:struct_link: link:https://alchemists.io/articles/ruby_structs[Struct]
|
19
19
|
:transactable_link: link:https://alchemists.io/projects/transactable[Transactable]
|
20
|
+
:versionaire_link: link:https://alchemists.io/projects/versionaire[Versionaire]
|
20
21
|
:xdg_link: link:https://alchemists.io/projects/xdg[XDG]
|
21
22
|
:yaml_link: link:https://rubyapi.org/o/yaml[YAML]
|
22
23
|
|
@@ -125,6 +126,18 @@ While this is a more advanced use case, you'll usually only need to register a c
|
|
125
126
|
|
126
127
|
ℹ️ 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.
|
127
128
|
|
129
|
+
=== Steps
|
130
|
+
|
131
|
+
As hinted at above, the complete sequence of steps are performed in the order listed:
|
132
|
+
|
133
|
+
. *Load*: Each loader, if any, is called and merged with the previous loader to build initial content.
|
134
|
+
. *Override*: Any overrides are merged with the result of the last loader to produce updated content.
|
135
|
+
. *Transform*: Each transformer, if any, is called to transform and manipulate the content.
|
136
|
+
. *Validate*: The contract is called to validate the content as previously loaded, overwritten, and transformed.
|
137
|
+
. *Model*: The model consumes the content of the validated contract and creates a new record for you to use as needed.
|
138
|
+
|
139
|
+
You can use the above steps as a reference when using this gem. Each step is explained in greater detail below.
|
140
|
+
|
128
141
|
=== Registry
|
129
142
|
|
130
143
|
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:
|
@@ -198,14 +211,16 @@ Here you can see the power of using a contract to validate your data both as a f
|
|
198
211
|
|
199
212
|
=== Types
|
200
213
|
|
201
|
-
To support contracts further,
|
214
|
+
To support contracts further, there are a couple custom types which might be of interest. Each custom type, as described below, is made possible via {dry_types_link}.
|
215
|
+
|
216
|
+
==== Pathnames
|
202
217
|
|
203
218
|
[source,ruby]
|
204
219
|
----
|
205
220
|
Etcher::Types::Pathname
|
206
221
|
----
|
207
222
|
|
208
|
-
|
223
|
+
The above allows you to use pathname types in your contracts to validate and cast as pathnames:
|
209
224
|
|
210
225
|
[source,ruby]
|
211
226
|
----
|
@@ -217,7 +232,24 @@ contract.call(path: "a/path").to_monad
|
|
217
232
|
# Success(#<Dry::Schema::Result{:path=>#<Pathname:a/path>} errors={} path=[]>)
|
218
233
|
----
|
219
234
|
|
220
|
-
|
235
|
+
==== Versions
|
236
|
+
|
237
|
+
[source,ruby]
|
238
|
+
----
|
239
|
+
Etcher::Types::Version
|
240
|
+
----
|
241
|
+
|
242
|
+
The above allows you to validate and cast versions within your contracts -- via the {versionaire_link} gem -- as follows:
|
243
|
+
|
244
|
+
[source,ruby]
|
245
|
+
----
|
246
|
+
contract = Dry::Schema.Params do
|
247
|
+
required(:version).filled Etcher::Types::Version
|
248
|
+
end
|
249
|
+
|
250
|
+
contract.call(version: "1.2.3").to_monad
|
251
|
+
# Success(#<Dry::Schema::Result{:version=>"1.2.3"} errors={} path=[]>)
|
252
|
+
----
|
221
253
|
|
222
254
|
=== Models
|
223
255
|
|
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.3.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/etcher"
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_dependency "dry-monads", "~> 1.6"
|
29
29
|
spec.add_dependency "dry-types", "~> 1.7"
|
30
30
|
spec.add_dependency "refinements", "~> 11.0"
|
31
|
+
spec.add_dependency "versionaire", "~> 12.1"
|
31
32
|
spec.add_dependency "zeitwerk", "~> 2.6"
|
32
33
|
|
33
34
|
spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
|
data/lib/etcher/types.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "dry/types"
|
4
4
|
require "pathname"
|
5
|
+
require "versionaire"
|
5
6
|
|
6
7
|
module Etcher
|
7
8
|
# Defines custom types.
|
@@ -9,5 +10,6 @@ module Etcher
|
|
9
10
|
include Dry.Types(default: :strict)
|
10
11
|
|
11
12
|
Pathname = Constructor ::Pathname
|
13
|
+
Version = Constructor Versionaire::Version, Versionaire.method(:Version)
|
12
14
|
end
|
13
15
|
end
|
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.3.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-07-12 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: cogger
|
@@ -107,6 +107,20 @@ dependencies:
|
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '11.0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: versionaire
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '12.1'
|
117
|
+
type: :runtime
|
118
|
+
prerelease: false
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '12.1'
|
110
124
|
- !ruby/object:Gem::Dependency
|
111
125
|
name: zeitwerk
|
112
126
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
182
|
- !ruby/object:Gem::Version
|
169
183
|
version: '0'
|
170
184
|
requirements: []
|
171
|
-
rubygems_version: 3.4.
|
185
|
+
rubygems_version: 3.4.15
|
172
186
|
signing_key:
|
173
187
|
specification_version: 4
|
174
188
|
summary: A monadic configuration loader, transformer, and validator.
|
metadata.gz.sig
CHANGED
Binary file
|