yerba 0.7.6-aarch64-linux-gnu → 0.8.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/README.md +66 -2
- data/exe/aarch64-linux-gnu/yerba +0 -0
- data/ext/yerba/include/yerba.h +8 -0
- data/ext/yerba/yerba.c +70 -8
- 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/map.rb +15 -10
- data/lib/yerba/node.rb +2 -2
- data/lib/yerba/sequence.rb +13 -1
- data/lib/yerba/version.rb +1 -1
- data/rust/Cargo.lock +2 -342
- data/rust/Cargo.toml +15 -6
- data/rust/src/commands/blank_lines.rs +2 -2
- data/rust/src/commands/directives.rs +4 -4
- data/rust/src/commands/get.rs +17 -10
- data/rust/src/commands/init.rs +4 -4
- data/rust/src/commands/insert.rs +6 -6
- data/rust/src/commands/location.rs +2 -2
- data/rust/src/commands/mate.rs +7 -7
- data/rust/src/commands/mod.rs +119 -90
- data/rust/src/commands/move_key.rs +9 -6
- data/rust/src/commands/quote_style.rs +4 -5
- data/rust/src/commands/rename.rs +3 -3
- data/rust/src/commands/schema.rs +6 -6
- data/rust/src/commands/selectors.rs +2 -2
- data/rust/src/commands/set.rs +12 -1
- data/rust/src/commands/sort.rs +36 -42
- data/rust/src/commands/sort_keys.rs +2 -2
- data/rust/src/commands/ui.rs +157 -0
- data/rust/src/commands/unique.rs +7 -7
- data/rust/src/commands/version.rs +13 -3
- data/rust/src/document/condition.rs +89 -32
- data/rust/src/document/delete.rs +6 -1
- data/rust/src/document/get.rs +94 -26
- data/rust/src/document/insert.rs +26 -0
- data/rust/src/document/mod.rs +73 -20
- data/rust/src/document/set.rs +91 -2
- data/rust/src/error.rs +17 -0
- data/rust/src/ffi.rs +76 -9
- data/rust/src/json.rs +10 -1
- data/rust/src/lib.rs +23 -7
- data/rust/src/main.rs +1 -0
- data/rust/src/quote_style.rs +12 -11
- data/rust/src/selector.rs +19 -3
- data/rust/src/syntax.rs +178 -26
- data/rust/src/yaml_writer.rs +4 -4
- data/rust/src/yerbafile.rs +30 -6
- metadata +3 -2
data/rust/src/yerbafile.rs
CHANGED
|
@@ -279,9 +279,33 @@ impl Yerbafile {
|
|
|
279
279
|
let content = fs::read_to_string(path.as_ref())?;
|
|
280
280
|
let mut yerbafile: Yerbafile = yaml_serde::from_str(&content).map_err(|error| YerbaError::ParseError(format!("{}", error)))?;
|
|
281
281
|
yerbafile.directory = path.as_ref().parent().map(|p| p.to_path_buf());
|
|
282
|
+
yerbafile.validate_conditions()?;
|
|
282
283
|
Ok(yerbafile)
|
|
283
284
|
}
|
|
284
285
|
|
|
286
|
+
fn validate_conditions(&self) -> Result<(), YerbaError> {
|
|
287
|
+
let pipelines = std::iter::once(&self.pipeline).chain(self.rules.iter().map(|rule| &rule.pipeline));
|
|
288
|
+
|
|
289
|
+
for pipeline in pipelines {
|
|
290
|
+
for step in pipeline {
|
|
291
|
+
let condition = match step {
|
|
292
|
+
PipelineStep::Set(config) => config.condition.as_deref(),
|
|
293
|
+
PipelineStep::Insert(config) => config.condition.as_deref(),
|
|
294
|
+
PipelineStep::Delete(config) => config.condition.as_deref(),
|
|
295
|
+
PipelineStep::Rename(config) => config.condition.as_deref(),
|
|
296
|
+
PipelineStep::Remove(config) => config.condition.as_deref(),
|
|
297
|
+
_ => None,
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
if let Some(condition) = condition {
|
|
301
|
+
crate::validate_condition(condition)?;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
Ok(())
|
|
307
|
+
}
|
|
308
|
+
|
|
285
309
|
pub fn resolve_path(&self, relative: &str) -> PathBuf {
|
|
286
310
|
match &self.directory {
|
|
287
311
|
Some(directory) => directory.join(relative),
|
|
@@ -675,7 +699,7 @@ fn execute_step(document: &mut Document, step: &PipelineStep, base_path: Option<
|
|
|
675
699
|
if let Some(condition) = &config.condition {
|
|
676
700
|
let parent_path = full_path.rsplit_once('.').map(|(parent, _)| parent).unwrap_or("");
|
|
677
701
|
|
|
678
|
-
if !document.evaluate_condition(parent_path, condition) {
|
|
702
|
+
if !document.evaluate_condition(parent_path, condition)? {
|
|
679
703
|
return Ok(());
|
|
680
704
|
}
|
|
681
705
|
}
|
|
@@ -689,7 +713,7 @@ fn execute_step(document: &mut Document, step: &PipelineStep, base_path: Option<
|
|
|
689
713
|
if let Some(condition) = &config.condition {
|
|
690
714
|
let parent_path = full_path.rsplit_once('.').map(|(parent, _)| parent).unwrap_or("");
|
|
691
715
|
|
|
692
|
-
if !document.evaluate_condition(parent_path, condition) {
|
|
716
|
+
if !document.evaluate_condition(parent_path, condition)? {
|
|
693
717
|
return Ok(());
|
|
694
718
|
}
|
|
695
719
|
}
|
|
@@ -707,7 +731,7 @@ fn execute_step(document: &mut Document, step: &PipelineStep, base_path: Option<
|
|
|
707
731
|
if let Some(condition) = &config.condition {
|
|
708
732
|
let parent_path = selector.rsplit_once('.').map(|(parent, _)| parent).unwrap_or("");
|
|
709
733
|
|
|
710
|
-
if !document.evaluate_condition(parent_path, condition) {
|
|
734
|
+
if !document.evaluate_condition(parent_path, condition)? {
|
|
711
735
|
continue;
|
|
712
736
|
}
|
|
713
737
|
}
|
|
@@ -720,7 +744,7 @@ fn execute_step(document: &mut Document, step: &PipelineStep, base_path: Option<
|
|
|
720
744
|
if let Some(condition) = &config.condition {
|
|
721
745
|
let parent_path = full_path.rsplit_once('.').map(|(parent, _)| parent).unwrap_or("");
|
|
722
746
|
|
|
723
|
-
if !document.evaluate_condition(parent_path, condition) {
|
|
747
|
+
if !document.evaluate_condition(parent_path, condition)? {
|
|
724
748
|
return Ok(());
|
|
725
749
|
}
|
|
726
750
|
}
|
|
@@ -735,7 +759,7 @@ fn execute_step(document: &mut Document, step: &PipelineStep, base_path: Option<
|
|
|
735
759
|
if let Some(condition) = &config.condition {
|
|
736
760
|
let parent_path = full_path.rsplit_once('.').map(|(parent, _)| parent).unwrap_or("");
|
|
737
761
|
|
|
738
|
-
if !document.evaluate_condition(parent_path, condition) {
|
|
762
|
+
if !document.evaluate_condition(parent_path, condition)? {
|
|
739
763
|
return Ok(());
|
|
740
764
|
}
|
|
741
765
|
}
|
|
@@ -749,7 +773,7 @@ fn execute_step(document: &mut Document, step: &PipelineStep, base_path: Option<
|
|
|
749
773
|
if let Some(condition) = &config.condition {
|
|
750
774
|
let parent_path = full_path.rsplit_once('.').map(|(parent, _)| parent).unwrap_or("");
|
|
751
775
|
|
|
752
|
-
if !document.evaluate_condition(parent_path, condition) {
|
|
776
|
+
if !document.evaluate_condition(parent_path, condition)? {
|
|
753
777
|
return Ok(());
|
|
754
778
|
}
|
|
755
779
|
}
|
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.
|
|
4
|
+
version: 0.8.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-07-
|
|
11
|
+
date: 2026-07-30 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.
|
|
@@ -68,6 +68,7 @@ files:
|
|
|
68
68
|
- rust/src/commands/set.rs
|
|
69
69
|
- rust/src/commands/sort.rs
|
|
70
70
|
- rust/src/commands/sort_keys.rs
|
|
71
|
+
- rust/src/commands/ui.rs
|
|
71
72
|
- rust/src/commands/unique.rs
|
|
72
73
|
- rust/src/commands/version.rs
|
|
73
74
|
- rust/src/didyoumean.rs
|