optify-config 1.13.0 → 1.15.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0daec0f9d7ba6e741f45b9e5745517d8e139cabe2a9e8cb396ce19dad2391a8a
4
- data.tar.gz: 49b7d76b1c823b22344fb209e4e1f88fee843e0d14b00aebc84d4df84585159b
3
+ metadata.gz: 55a934db67cdad6fb502d0ba8fc7d6fac5eb9db2688901eed595a176f88869c7
4
+ data.tar.gz: 28ca1c27d92034594efbaa3b1079734345ad6ac882c9a00e399f9e0326453ac8
5
5
  SHA512:
6
- metadata.gz: 88c486c478dbae77afa98420517cc4c313f6f70466419d7cda98a8e1a9ef57ff5d9e3324bd64e223b4588397e25046537d03c3eda6eb31240e6adfd3f3c45a71
7
- data.tar.gz: 7b56c4540377661de495f2f08b6fef2ab1bc84a345219afdbd06ece4aa79f8825a29beb2c8988b1152fb5c8713c94e1b2080b76ad6e20de118a939eb8581779f
6
+ metadata.gz: a01213353f8a1913b1df2940739c76861f67881958d03ef9ece8b17055537225df11d0c2cf6e6538e0ed7b0c1ebbcc2a71288473833fed2b7ca9dd7336d1dc89
7
+ data.tar.gz: b5fc790c785cdc689db5d181fdd5b483003b826a0e4b04c3591970356faa2879803aa677b3c07ef7070e656a2fe459855d9fbecae79a1ceac75ad6468ae58384
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "optify_ruby"
3
- version = "0.14.0"
3
+ version = "0.16.0"
4
4
  edition = "2021"
5
5
 
6
6
  description = "optify bindings for Ruby"
@@ -21,6 +21,6 @@ crate-type = ["cdylib"]
21
21
 
22
22
  [dependencies]
23
23
  magnus = "0.7.1"
24
- optify = { path = "../../../../rust/optify", version = "0.14.0" }
24
+ optify = { path = "../../../../rust/optify", version = "0.17.0" }
25
25
  rb-sys = { version = "*", default-features = false, features = ["ruby-static"] }
26
26
  serde_json = "1.0.140"
@@ -8,7 +8,6 @@ use optify::provider::OptionsRegistry;
8
8
  use optify::provider::OptionsWatcher;
9
9
  use optify::schema::metadata::OptionsMetadata;
10
10
  use std::cell::RefCell;
11
- use std::path::Path;
12
11
 
13
12
  fn convert_preferences(
14
13
  preferences: &MutGetOptionsPreferences,
@@ -76,7 +75,18 @@ fn convert_metadata(metadata: &OptionsMetadata) -> String {
76
75
 
77
76
  impl WrappedOptionsProvider {
78
77
  fn build(ruby: &Ruby, directory: String) -> Result<WrappedOptionsProvider, magnus::Error> {
79
- match OptionsProvider::build(Path::new(&directory)) {
78
+ match OptionsProvider::build(&directory) {
79
+ Ok(provider) => Ok(WrappedOptionsProvider(RefCell::new(provider))),
80
+ Err(e) => Err(magnus::Error::new(ruby.exception_runtime_error(), e)),
81
+ }
82
+ }
83
+
84
+ fn build_with_schema(
85
+ ruby: &Ruby,
86
+ directory: String,
87
+ schema_path: String,
88
+ ) -> Result<WrappedOptionsProvider, magnus::Error> {
89
+ match OptionsProvider::build_with_schema(&directory, &schema_path) {
80
90
  Ok(provider) => Ok(WrappedOptionsProvider(RefCell::new(provider))),
81
91
  Err(e) => Err(magnus::Error::new(ruby.exception_runtime_error(), e)),
82
92
  }
@@ -92,6 +102,17 @@ impl WrappedOptionsProvider {
92
102
  }
93
103
  }
94
104
 
105
+ fn build_from_directories_with_schema(
106
+ ruby: &Ruby,
107
+ directories: Vec<String>,
108
+ schema_path: String,
109
+ ) -> Result<WrappedOptionsProvider, magnus::Error> {
110
+ match OptionsProvider::build_from_directories_with_schema(&directories, &schema_path) {
111
+ Ok(provider) => Ok(WrappedOptionsProvider(RefCell::new(provider))),
112
+ Err(e) => Err(magnus::Error::new(ruby.exception_runtime_error(), e)),
113
+ }
114
+ }
115
+
95
116
  fn get_aliases(&self) -> Vec<String> {
96
117
  self.0.borrow().get_aliases()
97
118
  }
@@ -210,8 +231,7 @@ impl WrappedOptionsProviderBuilder {
210
231
  rb_self: &Self,
211
232
  directory: String,
212
233
  ) -> Result<WrappedOptionsProviderBuilder, magnus::Error> {
213
- let path = std::path::Path::new(&directory);
214
- match rb_self.0.borrow_mut().add_directory(path) {
234
+ match rb_self.0.borrow_mut().add_directory(&directory) {
215
235
  Ok(builder) => Ok(WrappedOptionsProviderBuilder(RefCell::new(builder.clone()))),
216
236
  Err(e) => Err(magnus::Error::new(ruby.exception_arg_error(), e)),
217
237
  }
@@ -230,7 +250,18 @@ struct WrappedOptionsWatcher(RefCell<OptionsWatcher>);
230
250
 
231
251
  impl WrappedOptionsWatcher {
232
252
  fn build(ruby: &Ruby, directory: String) -> Result<WrappedOptionsWatcher, magnus::Error> {
233
- match OptionsWatcher::build(Path::new(&directory)) {
253
+ match OptionsWatcher::build(&directory) {
254
+ Ok(provider) => Ok(WrappedOptionsWatcher(RefCell::new(provider))),
255
+ Err(e) => Err(magnus::Error::new(ruby.exception_runtime_error(), e)),
256
+ }
257
+ }
258
+
259
+ fn build_with_schema(
260
+ ruby: &Ruby,
261
+ directory: String,
262
+ schema_path: String,
263
+ ) -> Result<WrappedOptionsWatcher, magnus::Error> {
264
+ match OptionsWatcher::build_with_schema(&directory, &schema_path) {
234
265
  Ok(provider) => Ok(WrappedOptionsWatcher(RefCell::new(provider))),
235
266
  Err(e) => Err(magnus::Error::new(ruby.exception_runtime_error(), e)),
236
267
  }
@@ -246,6 +277,17 @@ impl WrappedOptionsWatcher {
246
277
  }
247
278
  }
248
279
 
280
+ fn build_from_directories_with_schema(
281
+ ruby: &Ruby,
282
+ directories: Vec<String>,
283
+ schema_path: String,
284
+ ) -> Result<WrappedOptionsWatcher, magnus::Error> {
285
+ match OptionsWatcher::build_from_directories_with_schema(&directories, &schema_path) {
286
+ Ok(provider) => Ok(WrappedOptionsWatcher(RefCell::new(provider))),
287
+ Err(e) => Err(magnus::Error::new(ruby.exception_runtime_error(), e)),
288
+ }
289
+ }
290
+
249
291
  fn get_aliases(&self) -> Vec<String> {
250
292
  self.0.borrow().get_aliases()
251
293
  }
@@ -364,8 +406,7 @@ impl WrappedOptionsWatcherBuilder {
364
406
  rb_self: &Self,
365
407
  directory: String,
366
408
  ) -> Result<WrappedOptionsWatcherBuilder, magnus::Error> {
367
- let path = std::path::Path::new(&directory);
368
- match rb_self.0.borrow_mut().add_directory(path) {
409
+ match rb_self.0.borrow_mut().add_directory(&directory) {
369
410
  Ok(builder) => Ok(WrappedOptionsWatcherBuilder(RefCell::new(builder.clone()))),
370
411
  Err(e) => Err(magnus::Error::new(ruby.exception_arg_error(), e)),
371
412
  }
@@ -395,10 +436,21 @@ fn init(ruby: &Ruby) -> Result<(), magnus::Error> {
395
436
 
396
437
  let provider_class = module.define_class("OptionsProvider", ruby.class_object())?;
397
438
  provider_class.define_singleton_method("build", function!(WrappedOptionsProvider::build, 1))?;
439
+ provider_class.define_singleton_method(
440
+ "build_with_schema",
441
+ function!(WrappedOptionsProvider::build_with_schema, 2),
442
+ )?;
398
443
  provider_class.define_singleton_method(
399
444
  "build_from_directories",
400
445
  function!(WrappedOptionsProvider::build_from_directories, 1),
401
446
  )?;
447
+ provider_class.define_singleton_method(
448
+ "build_from_directories_with_schema",
449
+ function!(
450
+ WrappedOptionsProvider::build_from_directories_with_schema,
451
+ 2
452
+ ),
453
+ )?;
402
454
  provider_class.define_method("aliases", method!(WrappedOptionsProvider::get_aliases, 0))?;
403
455
  provider_class.define_method("features", method!(WrappedOptionsProvider::get_features, 0))?;
404
456
  provider_class.define_method(
@@ -487,10 +539,18 @@ fn init(ruby: &Ruby) -> Result<(), magnus::Error> {
487
539
 
488
540
  let watcher_class = module.define_class("OptionsWatcher", ruby.class_object())?;
489
541
  watcher_class.define_singleton_method("build", function!(WrappedOptionsWatcher::build, 1))?;
542
+ watcher_class.define_singleton_method(
543
+ "build_with_schema",
544
+ function!(WrappedOptionsWatcher::build_with_schema, 2),
545
+ )?;
490
546
  watcher_class.define_singleton_method(
491
547
  "build_from_directories",
492
548
  function!(WrappedOptionsWatcher::build_from_directories, 1),
493
549
  )?;
550
+ watcher_class.define_singleton_method(
551
+ "build_from_directories_with_schema",
552
+ function!(WrappedOptionsWatcher::build_from_directories_with_schema, 2),
553
+ )?;
494
554
  watcher_class.define_method("aliases", method!(WrappedOptionsWatcher::get_aliases, 0))?;
495
555
  watcher_class.define_method("features", method!(WrappedOptionsWatcher::get_features, 0))?;
496
556
  watcher_class.define_method(
@@ -11,6 +11,10 @@ module Optify
11
11
  sig { returns(T.nilable(T::Array[String])) }
12
12
  attr_reader :aliases
13
13
 
14
+ # The canonical names of features that depend on this one.
15
+ sig { returns(T.nilable(T::Array[String])) }
16
+ attr_reader :dependents
17
+
14
18
  sig { returns(T.untyped) }
15
19
  attr_reader :details
16
20
 
@@ -19,5 +23,8 @@ module Optify
19
23
 
20
24
  sig { returns(T.nilable(String)) }
21
25
  attr_reader :owners
26
+
27
+ sig { returns(T.nilable(String)) }
28
+ attr_reader :path
22
29
  end
23
30
  end
data/rbi/optify.rbi CHANGED
@@ -37,6 +37,10 @@ module Optify
37
37
  sig { returns(T.nilable(T::Array[String])) }
38
38
  def aliases; end
39
39
 
40
+ # The canonical names of features that depend on this one.
41
+ sig { returns(T.nilable(T::Array[String])) }
42
+ def dependents; end
43
+
40
44
  sig { returns(T.untyped) }
41
45
  def details; end
42
46
 
@@ -45,6 +49,9 @@ module Optify
45
49
 
46
50
  sig { returns(T.nilable(String)) }
47
51
  def owners; end
52
+
53
+ sig { returns(T.nilable(String)) }
54
+ def path; end
48
55
  end
49
56
 
50
57
  # Preferences when getting options.
@@ -98,11 +105,25 @@ module Optify
98
105
  sig { params(directory: String).returns(T.attached_class) }
99
106
  def build(directory); end
100
107
 
108
+ # Build using just one directory and enforce a schema for all feature files.
109
+ # @param directory The directory to build the provider from.
110
+ # @param schema_path The path to the file of the schema to enforce.
111
+ # @return The instance.
112
+ sig { params(directory: String, schema_path: String).returns(T.attached_class) }
113
+ def build_with_schema(directory, schema_path); end
114
+
101
115
  # Build from multiple directories.
102
116
  # @param directories The directories to build the provider from.
103
117
  # @return The instance.
104
118
  sig { params(directories: T::Array[String]).returns(T.attached_class) }
105
119
  def build_from_directories(directories); end
120
+
121
+ # Build from multiple directories and enforce a schema for all feature files.
122
+ # @param directories The directories to build the provider from.
123
+ # @param schema The schema to enforce.
124
+ # @return The instance.
125
+ sig { params(directories: T::Array[String], schema_path: String).returns(T.attached_class) }
126
+ def build_from_directories_with_schema(directories, schema_path); end
106
127
  end
107
128
 
108
129
  # @return All of the aliases.
data/sig/optify.rbs CHANGED
@@ -31,11 +31,16 @@ end
31
31
  class Optify::OptionsMetadata < BaseConfig
32
32
  def aliases: () -> ::Array[String]?
33
33
 
34
+ # The canonical names of features that depend on this one.
35
+ def dependents: () -> ::Array[String]?
36
+
34
37
  def details: () -> untyped
35
38
 
36
39
  def name: () -> String
37
40
 
38
41
  def owners: () -> String?
42
+
43
+ def path: () -> String?
39
44
  end
40
45
 
41
46
  # Preferences when getting options.
@@ -76,11 +81,23 @@ class Optify::OptionsRegistry
76
81
  # @return The instance.
77
82
  def build: (String directory) -> instance
78
83
 
84
+ # Build using just one directory and enforce a schema for all feature files.
85
+ # @param directory The directory to build the provider from.
86
+ # @param schema_path The path to the file of the schema to enforce.
87
+ # @return The instance.
88
+ def build_with_schema: (String directory, String schema_path) -> instance
89
+
79
90
  # Build from multiple directories.
80
91
  # @param directories The directories to build the provider from.
81
92
  # @return The instance.
82
93
  def build_from_directories: (::Array[String] directories) -> instance
83
94
 
95
+ # Build from multiple directories and enforce a schema for all feature files.
96
+ # @param directories The directories to build the provider from.
97
+ # @param schema The schema to enforce.
98
+ # @return The instance.
99
+ def build_from_directories_with_schema: (::Array[String] directories, String schema_path) -> instance
100
+
84
101
  # @return All of the aliases.
85
102
  def aliases: () -> ::Array[String]
86
103
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optify-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin D. Harris
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-07-09 00:00:00.000000000 Z
10
+ date: 2025-08-17 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rb_sys