Skip to content

Commit 7eb16f6

Browse files
author
Nichol Yip
committed
Removed dead commented code and fixed du test with the correct sizes.
Signed-off-by: Nichol Yip <[email protected]>
1 parent cabb46c commit 7eb16f6

File tree

6 files changed

+11
-42
lines changed

6 files changed

+11
-42
lines changed

Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/spk-cli/cmd-du/src/cmd_du_test.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ async fn test_du_trivially_works() {
7272

7373
let mut expected_output = vec![
7474
"2local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/options.json",
75-
"160local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/spec.yaml",
75+
"82local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/spec.yaml",
7676
"0local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/build.cmpt",
7777
"17local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/build.sh",
7878
"0local/my-pkg/1.0.0/3I42H3S6/:run/spk/pkg/my-pkg/1.0.0/3I42H3S6/options.json",
@@ -343,7 +343,7 @@ async fn test_du_summarize_output_enabled() {
343343
let mut opt = Opt::try_parse_from(["du", "local/my-pkg", "-s"]).unwrap();
344344
opt.du.run().await.unwrap();
345345

346-
let expected_output = format!("179local/my-pkg/{}", "".red());
346+
let expected_output = format!("101local/my-pkg/{}", "".red());
347347
let mut generated_output = opt.du.output.vec.lock().unwrap()[0].clone();
348348
generated_output.retain(|c| !c.is_whitespace());
349349

@@ -382,7 +382,7 @@ async fn test_du_summarize_output_is_not_enabled() {
382382
"2local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/options.json",
383383
"0local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/build.cmpt",
384384
"17local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/build.sh",
385-
"160local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/spec.yaml",
385+
"82local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/spec.yaml",
386386
"0local/my-pkg/1.0.0/3I42H3S6/:run/spk/pkg/my-pkg/1.0.0/3I42H3S6/spec.yaml",
387387
"0local/my-pkg/1.0.0/3I42H3S6/:run/spk/pkg/my-pkg/1.0.0/3I42H3S6/options.json",
388388
"0local/my-pkg/1.0.0/3I42H3S6/:run/spk/pkg/my-pkg/1.0.0/3I42H3S6/run.cmpt",
@@ -440,7 +440,7 @@ async fn test_deprecate_flag() {
440440

441441
let mut opt_with_deprecate_flag = Opt::try_parse_from(["du", "local/my-pkg", "-ds"]).unwrap();
442442
opt_with_deprecate_flag.du.run().await.unwrap();
443-
let expected_output = format!("196local/my-pkg/{}", "DEPRECATED".red());
443+
let expected_output = format!("118local/my-pkg/{}", "DEPRECATED".red());
444444
let mut generated_output = opt_with_deprecate_flag.du.output.vec.lock().unwrap()[0].clone();
445445
generated_output.retain(|c| !c.is_whitespace());
446446
assert_eq!(expected_output, generated_output);

crates/spk-schema/crates/foundation/src/name/mod.rs

-6
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,6 @@ impl OptName {
177177
unsafe { Self::from_str("distro") }
178178
}
179179

180-
/// Standard option used to identify unrecognized keys for linting
181-
pub const fn unrecognized_key() -> &'static Self {
182-
// Safety: from_str skips validation, but this is a known good value
183-
unsafe { Self::from_str("unrecognized_key") }
184-
}
185-
186180
/// Validate the given string as an option name
187181
pub fn validate<S: AsRef<str> + ?Sized>(s: &S) -> Result<()> {
188182
validate_opt_name(s)

crates/spk-schema/crates/ident/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ format_serde_error = { version = "0.3", default_features = false, features = [
1717
"colored",
1818
] }
1919
itertools = "0.10"
20-
ngrammatic = "0.4.0"
2120
nom = { workspace = true }
2221
nom-supreme = { workspace = true }
2322
relative-path = "1.3"

crates/spk-schema/src/spec.rs

-30
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,6 @@ impl Template for SpecTemplate {
163163
.map_err(Error::InvalidTemplate)?;
164164
Ok(SpecRecipe::from_yaml(rendered)?)
165165
}
166-
167-
// fn render_lint(&self, options: &OptionMap) -> Result<Self::Output> {
168-
// let data = super::TemplateData::new(options);
169-
// let rendered = spk_schema_liquid::render_template(&self.template, &data)
170-
// .map_err(Error::InvalidTemplate)?;
171-
// Ok(SpecRecipe::from_yaml(rendered)?)
172-
// }
173166
}
174167

175168
impl TemplateExt for SpecTemplate {
@@ -229,29 +222,6 @@ impl TemplateExt for SpecTemplate {
229222
}
230223
}
231224

232-
// #[derive(Debug, Clone, Hash, Eq, PartialEq, Serialize)]
233-
// // #[enum_dispatch(Deprecate, DeprecateMut)]
234-
// pub enum SpecRecipeKind {
235-
// DefaultSpec(super::v0::Spec<VersionIdent>),
236-
// LintSpec(super::v0::LintedSpec<VersionIdent>)
237-
// }
238-
239-
// impl SpecRecipeKind {
240-
// pub fn spec(&self) -> &super::v0::Spec<VersionIdent> {
241-
// match self {
242-
// SpecRecipeKind::DefaultSpec(s) => s,
243-
// SpecRecipeKind::LintSpec(lint) => &lint.spec,
244-
// }
245-
// }
246-
247-
// pub fn lints(&self) -> Vec<String> {
248-
// match self {
249-
// SpecRecipeKind::DefaultSpec(_) => Vec::default(),
250-
// SpecRecipeKind::LintSpec(lint) => lint.lints.clone(),
251-
// }
252-
// }
253-
// }
254-
255225
/// Specifies some buildable object within the spk ecosystem.
256226
///
257227
/// All build-able types have a recipe representation

crates/spk-schema/src/v0/spec.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,13 @@ where
10111011
.as_ref()
10121012
.ok_or_else(|| serde::de::Error::missing_field("pkg"))?;
10131013

1014+
// if self.check_build_spec {
1015+
// if let Some(build_spec) = self.build {
1016+
// let unchecked_build_spec: UncheckedBuildSpec = build_spec.item;
1017+
// unchecked_build_spec.try_into().map_err(serde::de::Error::custom)?;
1018+
// }
1019+
// }
1020+
10141021
Ok(self)
10151022
// let pkg = self
10161023
// .pkg

0 commit comments

Comments
 (0)