optify-config 1.14.0 → 1.15.1
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
- data/ext/optify_ruby/Cargo.toml +3 -3
- data/ext/optify_ruby/src/lib.rs +67 -7
- data/lib/optify_ruby/options_metadata.rb +4 -0
- data/rbi/optify.rbi +26 -0
- data/sig/optify.rbs +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1b53fc9e31411125d7992a3792c0996e5ecaa601c6bd358cac87edfb892d23a
|
4
|
+
data.tar.gz: 81d918c1e6c158151acf7ecf9f42921a9923bf65b0715e9d513ddbc0abb0450d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6612e0b70c30545f9203faea8b0b6ccf8a3850b3a0591026f23d34c9e829eb9f614dd2ecd7cd68db744764b938d06a954619339357205cd04a48e9a1f26aa654
|
7
|
+
data.tar.gz: 1cc9a9a16641134cdcf8ca18f47009e4e8077409392e7f2a0166059f67ad7b5e89ee9fe9d48124d6471433fd9d90fcbe1b42d56b00400ac0c79e4bbb58fffe0b
|
data/ext/optify_ruby/Cargo.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[package]
|
2
2
|
name = "optify_ruby"
|
3
|
-
version = "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.
|
24
|
+
optify = { path = "../../../../rust/optify", version = "0.17.0" }
|
25
25
|
rb-sys = { version = "*", default-features = false, features = ["ruby-static"] }
|
26
|
-
serde_json = "1.0.
|
26
|
+
serde_json = "1.0.142"
|
data/ext/optify_ruby/src/lib.rs
CHANGED
@@ -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(
|
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
|
-
|
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(
|
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
|
-
|
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
|
|
data/rbi/optify.rbi
CHANGED
@@ -20,6 +20,14 @@ module Optify
|
|
20
20
|
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
21
21
|
def self.from_hash(hash); end
|
22
22
|
|
23
|
+
# Convert this object to a Hash recursively.
|
24
|
+
# This is mostly the reverse operation of `from_hash`,
|
25
|
+
# as keys will be symbols
|
26
|
+
# and `from_hash` will convert strings to symbols if that's how the attribute is declared.
|
27
|
+
# @return The hash representation of this object.
|
28
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
29
|
+
def to_h; end
|
30
|
+
|
23
31
|
# Compare this object with another object for equality.
|
24
32
|
# @param other The object to compare.
|
25
33
|
# @return [Boolean] true if the objects are equal; otherwise, false.
|
@@ -37,6 +45,10 @@ module Optify
|
|
37
45
|
sig { returns(T.nilable(T::Array[String])) }
|
38
46
|
def aliases; end
|
39
47
|
|
48
|
+
# The canonical names of features that depend on this one.
|
49
|
+
sig { returns(T.nilable(T::Array[String])) }
|
50
|
+
def dependents; end
|
51
|
+
|
40
52
|
sig { returns(T.untyped) }
|
41
53
|
def details; end
|
42
54
|
|
@@ -101,11 +113,25 @@ module Optify
|
|
101
113
|
sig { params(directory: String).returns(T.attached_class) }
|
102
114
|
def build(directory); end
|
103
115
|
|
116
|
+
# Build using just one directory and enforce a schema for all feature files.
|
117
|
+
# @param directory The directory to build the provider from.
|
118
|
+
# @param schema_path The path to the file of the schema to enforce.
|
119
|
+
# @return The instance.
|
120
|
+
sig { params(directory: String, schema_path: String).returns(T.attached_class) }
|
121
|
+
def build_with_schema(directory, schema_path); end
|
122
|
+
|
104
123
|
# Build from multiple directories.
|
105
124
|
# @param directories The directories to build the provider from.
|
106
125
|
# @return The instance.
|
107
126
|
sig { params(directories: T::Array[String]).returns(T.attached_class) }
|
108
127
|
def build_from_directories(directories); end
|
128
|
+
|
129
|
+
# Build from multiple directories and enforce a schema for all feature files.
|
130
|
+
# @param directories The directories to build the provider from.
|
131
|
+
# @param schema The schema to enforce.
|
132
|
+
# @return The instance.
|
133
|
+
sig { params(directories: T::Array[String], schema_path: String).returns(T.attached_class) }
|
134
|
+
def build_from_directories_with_schema(directories, schema_path); end
|
109
135
|
end
|
110
136
|
|
111
137
|
# @return All of the aliases.
|
data/sig/optify.rbs
CHANGED
@@ -16,6 +16,13 @@ class Optify::BaseConfig
|
|
16
16
|
# @return The new instance.
|
17
17
|
def self.from_hash: (::Hash[untyped, untyped] hash) -> instance
|
18
18
|
|
19
|
+
# Convert this object to a Hash recursively.
|
20
|
+
# This is mostly the reverse operation of `from_hash`,
|
21
|
+
# as keys will be symbols
|
22
|
+
# and `from_hash` will convert strings to symbols if that's how the attribute is declared.
|
23
|
+
# @return The hash representation of this object.
|
24
|
+
def to_h: () -> ::Hash[Symbol, untyped]
|
25
|
+
|
19
26
|
# Compare this object with another object for equality.
|
20
27
|
# @param other The object to compare.
|
21
28
|
# @return [Boolean] true if the objects are equal; otherwise, false.
|
@@ -31,6 +38,9 @@ end
|
|
31
38
|
class Optify::OptionsMetadata < BaseConfig
|
32
39
|
def aliases: () -> ::Array[String]?
|
33
40
|
|
41
|
+
# The canonical names of features that depend on this one.
|
42
|
+
def dependents: () -> ::Array[String]?
|
43
|
+
|
34
44
|
def details: () -> untyped
|
35
45
|
|
36
46
|
def name: () -> String
|
@@ -78,11 +88,23 @@ class Optify::OptionsRegistry
|
|
78
88
|
# @return The instance.
|
79
89
|
def build: (String directory) -> instance
|
80
90
|
|
91
|
+
# Build using just one directory and enforce a schema for all feature files.
|
92
|
+
# @param directory The directory to build the provider from.
|
93
|
+
# @param schema_path The path to the file of the schema to enforce.
|
94
|
+
# @return The instance.
|
95
|
+
def build_with_schema: (String directory, String schema_path) -> instance
|
96
|
+
|
81
97
|
# Build from multiple directories.
|
82
98
|
# @param directories The directories to build the provider from.
|
83
99
|
# @return The instance.
|
84
100
|
def build_from_directories: (::Array[String] directories) -> instance
|
85
101
|
|
102
|
+
# Build from multiple directories and enforce a schema for all feature files.
|
103
|
+
# @param directories The directories to build the provider from.
|
104
|
+
# @param schema The schema to enforce.
|
105
|
+
# @return The instance.
|
106
|
+
def build_from_directories_with_schema: (::Array[String] directories, String schema_path) -> instance
|
107
|
+
|
86
108
|
# @return All of the aliases.
|
87
109
|
def aliases: () -> ::Array[String]
|
88
110
|
|
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.
|
4
|
+
version: 1.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin D. Harris
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-08-
|
10
|
+
date: 2025-08-25 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rb_sys
|