etcher 0.0.0 → 0.1.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 +4 -1
- data/README.adoc +24 -0
- data/etcher.gemspec +3 -2
- data/lib/etcher/builder.rb +3 -3
- data/lib/etcher/types.rb +13 -0
- data.tar.gz.sig +0 -0
- metadata +18 -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: 34d9eedad8aac01a9cc35426821d3e8893d312f03c21aa22a75ceb808347248f
|
4
|
+
data.tar.gz: a24eaa182c934a5974031e5ab3502c5bc7ae927ab7323989626c86923839e6af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92e846388ce7fa423218b12db7c7082cdc4b9907bdfeebe6f0a86143ca0f3b82d053f35a6987a91d884bac2d9c9612d65abd5f764b41a8a423fc17837d842fe2
|
7
|
+
data.tar.gz: a7b0025873525c4e907ed455d5b5403bad83eac37d45710b62cc24339d75d22022797b18e42e92d51d72e6861da664854420ad8f901623d2f853054c866d4c8c
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,4 @@
|
|
1
|
-
|
1
|
+
y�k�?�_̑$$�<o,��x"W��|j��?6�qu�7�]#�Qņ��^
|
2
|
+
\�`�$�ٷn���X��'�1VN���TJ �����a�����<N�}�mp�-��?7Xˡ*ˡ
|
3
|
+
6�>:b�|�6�>�-�����l��Nڰ���d�u �t����귽�mG@e��`�o�6�0�Aqa/��i�i���������;_#/J���RK�d�{�_9�Tpj��XE~v�r��*
|
4
|
+
��ۤ�����И]�6��Qz�9����8Y<�U��c�W��8u3�_�
|
data/README.adoc
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
:dry_container_link: link:https://dry-rb.org/gems/dry-container[Dry Container]
|
8
8
|
:dry_monads_link: link:https://dry-rb.org/gems/dry-monads[Dry Monads]
|
9
9
|
:dry_schema_link: link:https://dry-rb.org/gems/dry-schema[Dry Schema]
|
10
|
+
:dry_types_link: link:https://dry-rb.org/gems/dry-types[Dry Types]
|
10
11
|
:dry_validation_link: link:https://dry-rb.org/gems/dry-validation[Dry Validation]
|
11
12
|
:environment_link: link:https://rubyapi.org/3.2/o/env[Environment]
|
12
13
|
:gitt_link: link:https://alchemists.io/projects/gitt[Gitt]
|
@@ -190,6 +191,29 @@ etcher.call from: "Mork", to: "Mindy"
|
|
190
191
|
|
191
192
|
Here you can see the power of using a contract to validate your data both as a failure and a success. Unfortunately, with the success, we only get a {hash_link} as a record and it would be nice to structured model which which we'll look at next.
|
192
193
|
|
194
|
+
=== Types
|
195
|
+
|
196
|
+
To support contracts further, especially when working with file paths, there is a custom type for pathnames:
|
197
|
+
|
198
|
+
[source,ruby]
|
199
|
+
----
|
200
|
+
Etcher::Types::Pathname
|
201
|
+
----
|
202
|
+
|
203
|
+
This means you can use this custom type in your contracts to validate and cast pathnames:
|
204
|
+
|
205
|
+
[source,ruby]
|
206
|
+
----
|
207
|
+
contract = Dry::Schema.Params do
|
208
|
+
required(:path).filled Etcher::Types::Pathname
|
209
|
+
end
|
210
|
+
|
211
|
+
contract.call(path: "a/path").to_monad
|
212
|
+
# Success(#<Dry::Schema::Result{:path=>#<Pathname:a/path>} errors={} path=[]>)
|
213
|
+
----
|
214
|
+
|
215
|
+
All of this is made possible via {dry_types_link} so make sure to check out documentation for details.
|
216
|
+
|
193
217
|
=== Models
|
194
218
|
|
195
219
|
A model is any object which responds to `.[]` and can accept a splatted hash. Example: `Model[**attributes]`. These primitives are excellent choices: {hash_link}, {data_link}, and {struct_link}.
|
data/etcher.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "etcher"
|
5
|
-
spec.version = "0.
|
5
|
+
spec.version = "0.1.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/etcher"
|
9
|
-
spec.summary = "A configuration loader, transformer, and validator."
|
9
|
+
spec.summary = "A monadic configuration loader, transformer, and validator."
|
10
10
|
spec.license = "Hippocratic-2.1"
|
11
11
|
|
12
12
|
spec.metadata = {
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency "cogger", "~> 0.9"
|
27
27
|
spec.add_dependency "core", "~> 0.1"
|
28
28
|
spec.add_dependency "dry-monads", "~> 1.6"
|
29
|
+
spec.add_dependency "dry-types", "~> 1.7"
|
29
30
|
spec.add_dependency "refinements", "~> 10.0"
|
30
31
|
spec.add_dependency "zeitwerk", "~> 2.6"
|
31
32
|
|
data/lib/etcher/builder.rb
CHANGED
@@ -16,9 +16,9 @@ module Etcher
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def call(**overrides)
|
19
|
-
load(overrides).then { |content| transform content }
|
20
|
-
|
21
|
-
|
19
|
+
load(overrides.symbolize_keys!).then { |content| transform content }
|
20
|
+
.bind { |content| validate content }
|
21
|
+
.bind { |content| record content }
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
data/lib/etcher/types.rb
ADDED
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.1.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-05-05 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: cogger
|
@@ -79,6 +79,20 @@ dependencies:
|
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '1.6'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: dry-types
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.7'
|
89
|
+
type: :runtime
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '1.7'
|
82
96
|
- !ruby/object:Gem::Dependency
|
83
97
|
name: refinements
|
84
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,6 +141,7 @@ files:
|
|
127
141
|
- lib/etcher/loaders/yaml.rb
|
128
142
|
- lib/etcher/registry.rb
|
129
143
|
- lib/etcher/resolver.rb
|
144
|
+
- lib/etcher/types.rb
|
130
145
|
homepage: https://alchemists.io/projects/etcher
|
131
146
|
licenses:
|
132
147
|
- Hippocratic-2.1
|
@@ -156,5 +171,5 @@ requirements: []
|
|
156
171
|
rubygems_version: 3.4.12
|
157
172
|
signing_key:
|
158
173
|
specification_version: 4
|
159
|
-
summary: A configuration loader, transformer, and validator.
|
174
|
+
summary: A monadic configuration loader, transformer, and validator.
|
160
175
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|