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/command/create_project_command.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'crates/shirabe/src/command/create_project_command.rs') diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs index d05f27d..0d5708d 100644 --- a/crates/shirabe/src/command/create_project_command.rs +++ b/crates/shirabe/src/command/create_project_command.rs @@ -113,8 +113,7 @@ impl CreateProjectCommand { _output: std::rc::Rc>, ) -> Result { let config = std::rc::Rc::new(std::cell::RefCell::new(Factory::create_config(None, None)?)); - // TODO(phase-b): get_io returns &mut Self-borrow; clone_box for an owned Box to dodge. - let io: std::rc::Rc> = self.get_io().clone(); + let io: std::rc::Rc> = self.get_io(); let (prefer_source, prefer_dist) = self.get_preferred_install_options(&config.borrow(), input.clone(), true)?; @@ -345,7 +344,11 @@ impl CreateProjectCommand { &placeholder_existing, ); let mut config_source = JsonConfigSource::new( - JsonFile::new("composer.json".to_string(), None, None)?, + std::rc::Rc::new(std::cell::RefCell::new(JsonFile::new( + "composer.json".to_string(), + None, + None, + )?)), false, ); @@ -544,7 +547,11 @@ impl CreateProjectCommand { if !has_vcs { let package = composer.get_package(); let mut config_source = JsonConfigSource::new( - JsonFile::new("composer.json".to_string(), None, None)?, + std::rc::Rc::new(std::cell::RefCell::new(JsonFile::new( + "composer.json".to_string(), + None, + None, + )?)), false, ); for (r#type, meta) in SUPPORTED_LINK_TYPES.iter() { -- cgit v1.3.1