Skip to content

Commit

Permalink
Improve ergonomics of export_package
Browse files Browse the repository at this point in the history
Signed-off-by: J Robert Ray <jrray@jrray.org>
  • Loading branch information
jrray committed Feb 26, 2024
1 parent 87e0d6d commit 7dda7c9
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/spk-build/src/archive_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async fn test_archive_create_parents() {
.await
.unwrap();
let filename = rt.tmpdir.path().join("deep/nested/path/archive.spk");
export_package::<_, _, NormalizedTagStrategy>(&spec.ident().to_any(), filename)
export_package::<NormalizedTagStrategy>(&spec.ident().to_any(), filename)
.await
.expect("export should create dirs as needed");
}
4 changes: 2 additions & 2 deletions crates/spk-cli/group3/src/cmd_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ impl Run for Export {
// TODO: this doesn't take the repos as an argument, but probably
// should. It assumes/uses 'local' and 'origin' repos internally.
let res = if self.legacy_spk_version_tags_for_writes {
storage::export_package::<_, _, VerbatimTagStrategy>(&pkg, &filename).await
storage::export_package::<VerbatimTagStrategy>(&pkg, &filename).await
} else {
storage::export_package::<_, _, NormalizedTagStrategy>(&pkg, &filename).await
storage::export_package::<NormalizedTagStrategy>(&pkg, &filename).await
};
if let Err(spk_storage::Error::PackageNotFound(_)) = res {
tracing::warn!("Ensure that you are specifying at least a package and");
Expand Down
2 changes: 1 addition & 1 deletion crates/spk-cli/group3/src/cmd_export_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async fn test_export_works_with_missing_builds() {

let filename = rt.tmpdir.path().join("archive.spk");
filename.ensure();
spk_storage::export_package::<_, _, NormalizedTagStrategy>(
spk_storage::export_package::<NormalizedTagStrategy>(
red_spec.ident().clone().to_version().to_any(None),
&filename,
)
Expand Down
2 changes: 1 addition & 1 deletion crates/spk-cli/group3/src/cmd_import_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async fn test_archive_io() {

let filename = rt.tmpdir.path().join("archive.spk");
filename.ensure();
spk_storage::export_package::<_, _, NormalizedTagStrategy>(spec.ident().to_any(), &filename)
spk_storage::export_package::<NormalizedTagStrategy>(spec.ident().to_any(), &filename)
.await
.expect("failed to export");
let mut actual = Vec::new();
Expand Down
4 changes: 1 addition & 3 deletions crates/spk-storage/src/storage/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ use spk_schema::{AnyIdent, BuildIdent, VersionIdent};
use super::{Repository, SpfsRepository};
use crate::{Error, NameAndRepositoryWithTagStrategy, Result};

pub async fn export_package<I, P, S>(pkg: I, filename: P) -> Result<()>
pub async fn export_package<S>(pkg: impl AsRef<AnyIdent>, filename: impl AsRef<Path>) -> Result<()>
where
I: AsRef<AnyIdent>,
P: AsRef<Path>,
S: TagPathStrategy + Send + Sync,
{
let pkg = pkg.as_ref();
Expand Down

0 comments on commit 7dda7c9

Please sign in to comment.