lode 0.1.1 → 1.0.1

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: c0c26a2071caf89746b1582a9bd24fdce30ca3cf2301292d8bb709f7f3ed1aae
4
- data.tar.gz: 3576a868e17557a2b079b44865481a0bb69cfae232b682aa2f881b32c0b77cc4
3
+ metadata.gz: 53547ef20d061cc6875625c4a82430c5a7c6b6d1826b41b56f16446ec9202085
4
+ data.tar.gz: d22865856c792c76dee3e58b8106285683d0fc2e78f752c69bc7603bb3581eb8
5
5
  SHA512:
6
- metadata.gz: 380058a439bf8a94889124a5340faae07f6c89d3812252217ff2a2be61719173c75de75ec655512676a4fff7aca216b01b936dfe6bf37099f5b5948f1be4ce95
7
- data.tar.gz: 6c3b82518cf8d3e05825f7c087863f018b45e9321c0da9ea28a459baac141bb534b5fe32304609666579f51ab606e2dec07e7273c593547fe5766f682a28078d
6
+ metadata.gz: b6cafe0d0ffdec73e06a76994bfdae4b9b4c9f3acb3e29a0415148ef6c00ea0163fef33afeef9224b2d1d468025385bc33fed160bc3b2708afbdab9f2433bd65
7
+ data.tar.gz: 590792995478977eb6e4abdf626a25e32d0c830154857f1fa6480d059acea8fdae0f6c968d6c655034e68c6ecbb642fed6208107e22c9d2e1595e25976b1702a
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -9,9 +9,9 @@
9
9
 
10
10
  = Lode
11
11
 
12
- Lode -- as in a geological deposit or a vein of minerals -- is a {pstore_link} of object data that can be mined for valuable information.
12
+ Lode -- as in geological deposit or a vein of minerals -- is a {pstore_link} of object data that can be mined for valuable information.
13
13
 
14
- As noted in the {pstore_link} documentation all objects are marshaled which is not without caveats and dangers but, if you only need a simple object store, {pstore_link} is a solution. Lode takes this a step further by allowing you to have a pipeline workflow with a Domain Specific Language (DSL) for creating, updating, finding, and deleting records.
14
+ As noted in the {pstore_link} documentation all objects are marshaled which is not without caveats and dangers but, if you only need a simple object store, {pstore_link} is a solution. Lode takes this a step further by allowing you to have a pipeline workflow along with a Domain Specific Language (DSL) for creating, updating, finding, and deleting records.
15
15
 
16
16
  toc::[]
17
17
 
@@ -141,6 +141,19 @@ Each key can be configured as follows:
141
141
  * `primary_key`: Defines the primary key used when interacting with your table of records (useful when finding or upserting records). Default: `:id`.
142
142
  * `registry`: Used for registering default settings for your tables. _This is not meant to be used directly_ but is documented for transparency.
143
143
 
144
+ === Paths
145
+
146
+ Upon initialization, and when given a file, the file is only created once you start saving records. Although, when given a nested path, the full parent path will be created in anticipation of the file eventually being created. Example:
147
+
148
+ [source,ruby]
149
+ ----
150
+ # The file, "demo.store", is not created until data is saved.
151
+ Lode.new "demo.store"
152
+
153
+ # The path, "a/nested/path", will be created so `demo.store` can eventually be saved.
154
+ Lode.new "a/nested/path/demo.store"
155
+ ----
156
+
144
157
  === Registry
145
158
 
146
159
  The registry is part of the configuration and directly accessible via a Lode instance. The registry allows you to customize individual table behavior as desired. For instance, you could have a `Hash` table or value table (i.e. `Data`, `Struct`, etc). Additionally, each table can have different primary keys too. The registry accepts three arguments in this format:
data/lib/lode/client.rb CHANGED
@@ -1,12 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "forwardable"
4
+ require "refinements/pathname"
4
5
 
5
6
  module Lode
6
7
  # Provides an enhanced PStore-based client.
7
8
  class Client
8
9
  extend Forwardable
9
10
 
11
+ using Refinements::Pathname
12
+
10
13
  attr_reader :path, :store
11
14
 
12
15
  delegate %i[register registry] => :configuration
@@ -14,7 +17,7 @@ module Lode
14
17
  def initialize path, configuration: Configuration.new
15
18
  yield configuration if block_given?
16
19
 
17
- @path = path
20
+ @path = Pathname(path).make_ancestors
18
21
  @configuration = configuration
19
22
  @store = configuration.store_for path
20
23
  end
@@ -27,10 +30,12 @@ module Lode
27
30
 
28
31
  attr_reader :configuration
29
32
 
30
- def transact(mode, key, &)
33
+ # rubocop:todo Naming/BlockForwarding
34
+ def transact mode, key, &block
31
35
  store.transaction mode == :read do
32
- configuration.table_for(store, key).instance_eval(&)
36
+ configuration.table_for(store, key).instance_eval(&block)
33
37
  end
34
38
  end
39
+ # rubocop:enable Naming/BlockForwarding
35
40
  end
36
41
  end
@@ -6,7 +6,7 @@ module Lode
6
6
  # Models the default configuration.
7
7
  Configuration = Struct.new :store, :mode, :table, :primary_key, :registry do
8
8
  using Refines::PersistentStore
9
- using Refinements::Arrays
9
+ using Refinements::Array
10
10
 
11
11
  def initialize store: PStore,
12
12
  mode: :default,
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "pstore"
4
- require "refinements/arrays"
4
+ require "refinements/array"
5
5
 
6
6
  module Lode
7
7
  module Refines
8
- # Refined and enhanced PStore functionality.
8
+ # Refines and enhances PStore functionality.
9
9
  module PersistentStore
10
- using Refinements::Arrays
10
+ using Refinements::Array
11
11
 
12
12
  refine PStore.singleton_class do
13
13
  def with path, mode: :default
data/lib/lode/setting.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lode
4
+ # Defines a configuration setting.
4
5
  Setting = Data.define :model, :primary_key do
5
6
  def initialize model: Hash, primary_key: PRIMARY_KEY
6
7
  super
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "dry/monads"
4
- require "refinements/arrays"
4
+ require "refinements/array"
5
5
 
6
6
  module Lode
7
7
  module Tables
@@ -9,7 +9,7 @@ module Lode
9
9
  class Abstract
10
10
  include Dry::Monads[:result]
11
11
 
12
- using Refinements::Arrays
12
+ using Refinements::Array
13
13
 
14
14
  def initialize store, key, setting: Setting.new
15
15
  @store = store
data/lode.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "lode"
5
- spec.version = "0.1.1"
5
+ spec.version = "1.0.1"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/lode"
@@ -22,9 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.signing_key = Gem.default_key_path
23
23
  spec.cert_chain = [Gem.default_cert_path]
24
24
 
25
- spec.required_ruby_version = [">= 3.2", "<= 3.3"]
25
+ spec.required_ruby_version = "~> 3.3"
26
26
  spec.add_dependency "dry-monads", "~> 1.6"
27
- spec.add_dependency "refinements", "~> 11.0"
27
+ spec.add_dependency "refinements", "~> 12.0"
28
28
  spec.add_dependency "zeitwerk", "~> 2.6"
29
29
 
30
30
  spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.1
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-11-15 00:00:00.000000000 Z
38
+ date: 2024-01-07 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: dry-monads
@@ -57,14 +57,14 @@ dependencies:
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '11.0'
60
+ version: '12.0'
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '11.0'
67
+ version: '12.0'
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: zeitwerk
70
70
  requirement: !ruby/object:Gem::Requirement
@@ -116,10 +116,7 @@ require_paths:
116
116
  - lib
117
117
  required_ruby_version: !ruby/object:Gem::Requirement
118
118
  requirements:
119
- - - ">="
120
- - !ruby/object:Gem::Version
121
- version: '3.2'
122
- - - "<="
119
+ - - "~>"
123
120
  - !ruby/object:Gem::Version
124
121
  version: '3.3'
125
122
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -128,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
125
  - !ruby/object:Gem::Version
129
126
  version: '0'
130
127
  requirements: []
131
- rubygems_version: 3.4.22
128
+ rubygems_version: 3.5.4
132
129
  signing_key:
133
130
  specification_version: 4
134
131
  summary: A monadic store of marshaled objects.
metadata.gz.sig CHANGED
Binary file