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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f77fefa60ba596414bd1453ca278ef82a4839286e4c822260bbf7ed391b2fa5a
4
- data.tar.gz: 34076cfa28541ac3f6778bde4167a758473bb03874aa3233029df6248af24c78
3
+ metadata.gz: 34d9eedad8aac01a9cc35426821d3e8893d312f03c21aa22a75ceb808347248f
4
+ data.tar.gz: a24eaa182c934a5974031e5ab3502c5bc7ae927ab7323989626c86923839e6af
5
5
  SHA512:
6
- metadata.gz: f6c2d11ab82fb53535fb7606e5a160381febab7632eb39f8fe91b677b629416536016db42f1838a2a59cf0c51595f6647762758b70356685a7194bda023ac00e
7
- data.tar.gz: 260f3e2e1e55d3a82d862aa3140a453f7a357dbc8a5e0702f472e113d180b62b0bd011f641c612846230726b5514231c7b7412fa07cfe3251ad3dc126d204493
6
+ metadata.gz: 92e846388ce7fa423218b12db7c7082cdc4b9907bdfeebe6f0a86143ca0f3b82d053f35a6987a91d884bac2d9c9612d65abd5f764b41a8a423fc17837d842fe2
7
+ data.tar.gz: a7b0025873525c4e907ed455d5b5403bad83eac37d45710b62cc24339d75d22022797b18e42e92d51d72e6861da664854420ad8f901623d2f853054c866d4c8c
checksums.yaml.gz.sig CHANGED
@@ -1 +1,4 @@
1
- v��*�m���JЄ�p��u-Ϸ�u��Kҩ�� U��QlWkZ���%F3�}*�eO��|g˶���q�h4a&�])��d,yY�0 q�O?�KdnQ�^v\��K�b�x�\�fj�G�/OE� ��G�ݏ�Rҽ�T�+��/�R&������Y�y�nr�&�z�:܈���?X�F��
1
+ yk�?�_̑$$�<o,��x"W��|j��?6qu�7�]#�Qņ��^
2
+ \�`�$�ٷn���X��'�1VN���TJ �����a�����<N�}�mp�-��?7Xˡ*ˡ
3
+ 6�>:b�|�6�>�-�����l��Nڰ���d�u �t����귽�m G@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.0.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
 
@@ -16,9 +16,9 @@ module Etcher
16
16
  end
17
17
 
18
18
  def call(**overrides)
19
- load(overrides).then { |content| transform content }
20
- .bind { |content| validate content }
21
- .bind { |content| record content }
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
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry/types"
4
+ require "pathname"
5
+
6
+ module Etcher
7
+ # Defines custom types.
8
+ module Types
9
+ include Dry.Types(default: :strict)
10
+
11
+ Pathname = Constructor ::Pathname
12
+ end
13
+ 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.0.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-04-23 00:00:00.000000000 Z
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