yerba 0.9.0-aarch64-linux-gnu → 0.9.1-aarch64-linux-gnu
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/exe/aarch64-linux-gnu/yerba +0 -0
- data/ext/yerba/include/yerba.h +2 -0
- data/ext/yerba/yerba.c +18 -0
- data/lib/yerba/3.2/yerba.so +0 -0
- data/lib/yerba/3.3/yerba.so +0 -0
- data/lib/yerba/3.4/yerba.so +0 -0
- data/lib/yerba/4.0/yerba.so +0 -0
- data/lib/yerba/version.rb +1 -1
- data/rust/Cargo.lock +1 -1
- data/rust/Cargo.toml +1 -1
- data/rust/src/commands/blank_lines.rs +1 -0
- data/rust/src/document/mod.rs +13 -1
- data/rust/src/ffi.rs +5 -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: 511327aa49d8c9f0e9e2c739a059d5e78dcffd11acc85a1dd2b2962f6d60f4a1
|
|
4
|
+
data.tar.gz: 5717396d5a174922f4ce7ce2050d6bb170ced9ad9b6d22c57a80680160ca9c7a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c7b4afdff3d69e24995407c42e0a7f7c775a9648435abb46bdb2a93f876486890b54fadfca20513fa26f8daf35de3e102c0ec75c2a26a5b711e4c92d08fe5d8f
|
|
7
|
+
data.tar.gz: 98308386a28b1a81680609c9b0f051090bc5f3e9eff94daafa3dad7b64aabdd8c9ebcb1873683a69945262d9d05b657a707ede983887ce4ad41f965bbc36309b
|
data/exe/aarch64-linux-gnu/yerba
CHANGED
|
Binary file
|
data/ext/yerba/include/yerba.h
CHANGED
|
@@ -68,6 +68,8 @@ struct YerbaParseResult yerba_document_parse_file(const char *path);
|
|
|
68
68
|
|
|
69
69
|
struct YerbaParseResult yerba_document_parse(const char *content);
|
|
70
70
|
|
|
71
|
+
uint64_t yerba_document_generation(const struct Document *document);
|
|
72
|
+
|
|
71
73
|
void yerba_document_free(struct Document *document);
|
|
72
74
|
|
|
73
75
|
struct YerbaGetResult yerba_document_get(const struct Document *document, const char *path);
|
data/ext/yerba/yerba.c
CHANGED
|
@@ -339,6 +339,23 @@ static VALUE document_get_value(VALUE self, VALUE path) {
|
|
|
339
339
|
return rb_funcall(rb_path2class("JSON"), rb_intern("parse"), 1, json_string);
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
+
/* document.values → the whole document as Ruby objects, cached until the document changes */
|
|
343
|
+
static VALUE document_values(VALUE self) {
|
|
344
|
+
struct Document *document = get_document(self);
|
|
345
|
+
VALUE generation = ULL2NUM(yerba_document_generation(document));
|
|
346
|
+
|
|
347
|
+
if (rb_equal(rb_ivar_get(self, rb_intern("values_generation")), generation)) {
|
|
348
|
+
return rb_ivar_get(self, rb_intern("values"));
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
VALUE values = document_get_value(self, make_utf8_string(""));
|
|
352
|
+
|
|
353
|
+
rb_ivar_set(self, rb_intern("values"), values);
|
|
354
|
+
rb_ivar_set(self, rb_intern("values_generation"), generation);
|
|
355
|
+
|
|
356
|
+
return values;
|
|
357
|
+
}
|
|
358
|
+
|
|
342
359
|
/* document.selectors → ["database", "database.host", "tags", "tags[]", ...] */
|
|
343
360
|
static VALUE document_selectors(VALUE self) {
|
|
344
361
|
struct Document *document = get_document(self);
|
|
@@ -1189,6 +1206,7 @@ void Init_yerba(void) {
|
|
|
1189
1206
|
rb_define_method(rb_cDocument, "[]", document_bracket, 1);
|
|
1190
1207
|
rb_define_method(rb_cDocument, "node_at", document_bracket, 1);
|
|
1191
1208
|
rb_define_method(rb_cDocument, "value_at", document_get_value, 1);
|
|
1209
|
+
rb_define_method(rb_cDocument, "values", document_values, 0);
|
|
1192
1210
|
rb_define_method(rb_cDocument, "get_all", document_get_all, 1);
|
|
1193
1211
|
rb_define_method(rb_cDocument, "location", document_location, -1);
|
|
1194
1212
|
rb_define_method(rb_cDocument, "locations", document_locations, 1);
|
data/lib/yerba/3.2/yerba.so
CHANGED
|
Binary file
|
data/lib/yerba/3.3/yerba.so
CHANGED
|
Binary file
|
data/lib/yerba/3.4/yerba.so
CHANGED
|
Binary file
|
data/lib/yerba/4.0/yerba.so
CHANGED
|
Binary file
|
data/lib/yerba/version.rb
CHANGED
data/rust/Cargo.lock
CHANGED
data/rust/Cargo.toml
CHANGED
|
@@ -34,6 +34,7 @@ pub struct Args {
|
|
|
34
34
|
/// Comma-separated map keys to separate from what follows them
|
|
35
35
|
#[arg(long)]
|
|
36
36
|
after: Option<String>,
|
|
37
|
+
/// Leave entries alone when their value is null, an empty collection, or an empty string
|
|
37
38
|
#[arg(long)]
|
|
38
39
|
skip_empty: bool,
|
|
39
40
|
#[arg(long)]
|
data/rust/src/document/mod.rs
CHANGED
|
@@ -31,6 +31,7 @@ pub struct LocatedNode {
|
|
|
31
31
|
|
|
32
32
|
use std::fs;
|
|
33
33
|
use std::path::{Path, PathBuf};
|
|
34
|
+
use std::sync::atomic::{AtomicU64, Ordering};
|
|
34
35
|
|
|
35
36
|
use rowan::ast::AstNode;
|
|
36
37
|
use rowan::{TextRange, TextSize};
|
|
@@ -126,10 +127,13 @@ pub enum InsertPosition {
|
|
|
126
127
|
FromSortOrder(Vec<String>),
|
|
127
128
|
}
|
|
128
129
|
|
|
130
|
+
static NEXT_GENERATION: AtomicU64 = AtomicU64::new(1);
|
|
131
|
+
|
|
129
132
|
#[derive(Debug)]
|
|
130
133
|
pub struct Document {
|
|
131
134
|
root: SyntaxNode,
|
|
132
135
|
path: Option<PathBuf>,
|
|
136
|
+
generation: u64,
|
|
133
137
|
}
|
|
134
138
|
|
|
135
139
|
impl Document {
|
|
@@ -138,7 +142,15 @@ impl Document {
|
|
|
138
142
|
|
|
139
143
|
check_duplicate_keys(&tree)?;
|
|
140
144
|
|
|
141
|
-
Ok(Document {
|
|
145
|
+
Ok(Document {
|
|
146
|
+
root: tree,
|
|
147
|
+
path: None,
|
|
148
|
+
generation: NEXT_GENERATION.fetch_add(1, Ordering::Relaxed),
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
pub fn generation(&self) -> u64 {
|
|
153
|
+
self.generation
|
|
142
154
|
}
|
|
143
155
|
|
|
144
156
|
pub fn parse_file(path: impl AsRef<Path>) -> Result<Self, YerbaError> {
|
data/rust/src/ffi.rs
CHANGED
|
@@ -217,6 +217,11 @@ const EMPTY_LOCATION: YerbaLocation = YerbaLocation {
|
|
|
217
217
|
end_column: 0,
|
|
218
218
|
};
|
|
219
219
|
|
|
220
|
+
#[no_mangle]
|
|
221
|
+
pub unsafe extern "C" fn yerba_document_generation(document: *const Document) -> u64 {
|
|
222
|
+
(*document).generation()
|
|
223
|
+
}
|
|
224
|
+
|
|
220
225
|
#[no_mangle]
|
|
221
226
|
pub unsafe extern "C" fn yerba_document_free(document: *mut Document) {
|
|
222
227
|
if !document.is_null() {
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yerba
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.1
|
|
5
5
|
platform: aarch64-linux-gnu
|
|
6
6
|
authors:
|
|
7
7
|
- Marco Roth
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-10-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A CLI tool for editing YAML while preserving structure, comments, and
|
|
14
14
|
format.
|