From 971824aa15334fd12d08ae0f441f6bf6079344c3 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 7 Jun 2026 10:33:53 +0900 Subject: feat(shirabe): resolve phase-b TODOs with shared ownership Replace TODO(phase-b) placeholders (todo!() and commented-out code) with real implementations: - Share JsonFile via Rc> so JsonConfigSource and the owning command can hold the same instance (base_config_command, config_command, repository_command, require_command, create_project, remove_command, factory) - Change InstallerInterface methods (is_installed, download, prepare, cleanup, get_install_path) to &mut self so initialize_vendor_dir can run, propagated to all installer implementations - Pass io/config/filesystem/process by clone instead of moving or stubbing (auth_helper, svn_driver, curl_downloader, library_installer) - Make TransportException Clone and store it by value in VcsRepository - Clone operations in Transaction sort, root_aliases/temporary_constraints in RepositorySet::create_pool, and share CompletePackage via handle in PlatformRepository - Wire up set_option, set_requires/set_dev_requires, installation manager setters, BumpCommand::set_composer, and clean_backups/set_local_phar --- crates/shirabe/src/factory.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'crates/shirabe/src/factory.rs') diff --git a/crates/shirabe/src/factory.rs b/crates/shirabe/src/factory.rs index cdad33c..95511b0 100644 --- a/crates/shirabe/src/factory.rs +++ b/crates/shirabe/src/factory.rs @@ -295,7 +295,10 @@ impl Factory { config.merge(&read_data, &file_path_owned); } // TODO(phase-b): set_config_source takes Box - config.set_config_source(Box::new(JsonConfigSource::new(file, false))); + config.set_config_source(Box::new(JsonConfigSource::new( + std::rc::Rc::new(std::cell::RefCell::new(file)), + false, + ))); let htaccess_protect = config.get("htaccess-protect").as_bool().unwrap_or(false); if htaccess_protect { @@ -359,7 +362,10 @@ impl Factory { config.merge(&wrapped, &auth_path_owned); } // TODO(phase-b): set_auth_config_source takes Box - config.set_auth_config_source(Box::new(JsonConfigSource::new(auth_file, true))); + config.set_auth_config_source(Box::new(JsonConfigSource::new( + std::rc::Rc::new(std::cell::RefCell::new(auth_file)), + true, + ))); Self::load_composer_auth_env(&mut config, io)?; @@ -526,11 +532,11 @@ impl Factory { crate::io::DEBUG, ); config.set_config_source(Box::new(JsonConfigSource::new( - JsonFile::new( + std::rc::Rc::new(std::cell::RefCell::new(JsonFile::new( realpath(composer_file_path).unwrap_or_default(), None, Some(io.clone()), - )?, + )?)), false, ))); @@ -557,7 +563,7 @@ impl Factory { let auth_path = local_auth_file.get_path().to_string(); config.merge(&wrapped, &auth_path); config.set_local_auth_config_source(Box::new(JsonConfigSource::new( - local_auth_file, + std::rc::Rc::new(std::cell::RefCell::new(local_auth_file)), true, ))); } -- cgit v1.3.1