aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/repository_manager.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-25 17:49:35 +0900
committernsfisis <nsfisis@gmail.com>2026-06-26 00:20:05 +0900
commitd4ec1dcb6fc04ff029ded35cc2fcc14f3bbc02ad (patch)
tree0a85bd085961fcdfd5570cafc3b44ba5eb8cb152 /crates/shirabe/src/repository/repository_manager.rs
parent22d0b327368e5f39de6f381046c081d08efdba15 (diff)
downloadphp-shirabe-d4ec1dcb6fc04ff029ded35cc2fcc14f3bbc02ad.tar.gz
php-shirabe-d4ec1dcb6fc04ff029ded35cc2fcc14f3bbc02ad.tar.zst
php-shirabe-d4ec1dcb6fc04ff029ded35cc2fcc14f3bbc02ad.zip
test: port 32 command/repository/downloader tests
Add create_installed_json/create_composer_lock test helpers. Port command (8), repository path/forgejo/perforce/vcs (11), and fossil/hg/download_manager (13) tests. Fix production porting bugs: root_package_loader/forgejo_url/version_bumper regex delimiters, repository_manager create_repository_by_class, array_loader isset, licenses_command RefCell borrow; implement disk_free_space and touch2/touch3 via libc. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository/repository_manager.rs')
-rw-r--r--crates/shirabe/src/repository/repository_manager.rs26
1 files changed, 23 insertions, 3 deletions
diff --git a/crates/shirabe/src/repository/repository_manager.rs b/crates/shirabe/src/repository/repository_manager.rs
index 403b504..247236c 100644
--- a/crates/shirabe/src/repository/repository_manager.rs
+++ b/crates/shirabe/src/repository/repository_manager.rs
@@ -147,10 +147,30 @@ impl RepositoryManager {
fn create_repository_by_class(
&self,
- _class: &str,
- _config: IndexMap<String, PhpMixed>,
+ class: &str,
+ config: IndexMap<String, PhpMixed>,
) -> anyhow::Result<RepositoryInterfaceHandle> {
- todo!("Phase B: dynamic class instantiation by class name")
+ // PHP: `new $class($config, $this->io, $this->config, $this->httpDownloader,
+ // $this->eventDispatcher, $this->process)`. Rust cannot instantiate by string class name, so
+ // dispatch over the classes registered in `createDefaultRepositoryManager`.
+ match class {
+ "Composer\\Repository\\ComposerRepository" => Ok(RepositoryInterfaceHandle::new(
+ crate::repository::ComposerRepository::new(
+ config,
+ self.io.clone(),
+ &self.config.borrow(),
+ self.http_downloader.clone(),
+ self.event_dispatcher.clone(),
+ )?,
+ )),
+ "Composer\\Repository\\PackageRepository" => Ok(RepositoryInterfaceHandle::new(
+ crate::repository::PackageRepository::new(config),
+ )),
+ other => todo!(
+ "Phase B: dynamic class instantiation by class name: {}",
+ other
+ ),
+ }
}
pub fn set_repository_class(&mut self, r#type: &str, class: &str) {