Skip to content

Commit

Permalink
feat: work on initializing repositories.json
Browse files Browse the repository at this point in the history
  • Loading branch information
n-dusan committed Dec 13, 2023
1 parent f02d1b5 commit 25d78c1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/archive_testtools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,29 @@ pub fn get_basic_test_data_repositories() -> Result<Vec<TestDataRepositoryContex
])
}

impl From<TestDataRepositoryContext<'_>> for Repository {
fn from(context: TestDataRepositoryContext) -> Self {
let mut custom = Custom::default();
custom.repository_type = Some(match context.kind {
TestDataRepositoryType::Html => "html".to_string(),
TestDataRepositoryType::Rdf => "rdf".to_string(),
TestDataRepositoryType::Xml => "xml".to_string(),
TestDataRepositoryType::Pdf => "pdf".to_string(),
TestDataRepositoryType::Other(_) => "other".to_string(),
});
custom.serve = "latest".to_string();
custom.scope = context.serve_prefix.map(|s| s.to_string());
custom.routes = context
.route_glob_patterns
.map(|r| r.iter().map(|s| s.to_string()).collect());
custom.is_fallback = Some(context.is_fallback);
Self {
name: context.name.to_string(),
custom,
}
}
}

pub struct GitRepository {
pub repo: git2::Repository,
pub path: PathBuf,
Expand Down

0 comments on commit 25d78c1

Please sign in to comment.