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/util/auth_helper.rs | 38 +++++++--------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) (limited to 'crates/shirabe/src/util/auth_helper.rs') diff --git a/crates/shirabe/src/util/auth_helper.rs b/crates/shirabe/src/util/auth_helper.rs index 61970f2..2709751 100644 --- a/crates/shirabe/src/util/auth_helper.rs +++ b/crates/shirabe/src/util/auth_helper.rs @@ -147,13 +147,7 @@ impl AuthHelper { .any(|v| v.as_string() == Some(origin)); if in_github_domains { - let mut git_hub_util = GitHub::new( - // TODO(phase-b): clone or borrow io/config rather than moving - todo!("io clone"), - todo!("config clone"), - None, - None, - )?; + let mut git_hub_util = GitHub::new(self.io.clone(), self.config.clone(), None, None)?; let mut message = "\n".to_string(); let rate_limited = git_hub_util.is_rate_limited(&headers); @@ -258,13 +252,7 @@ impl AuthHelper { "to go over the API rate limit" }, ); - let mut git_lab_util = GitLab::new( - // TODO(phase-b): clone or borrow io/config rather than moving - todo!("io clone"), - todo!("config clone"), - None, - None, - )?; + let mut git_lab_util = GitLab::new(self.io.clone(), self.config.clone(), None, None)?; let mut auth: Option>> = None; if self.io.has_authentication(origin) { @@ -330,14 +318,8 @@ impl AuthHelper { .and_then(|v| v.clone()) .unwrap_or_default(); if username != "x-token-auth" { - let mut bitbucket_util = Bitbucket::new( - // TODO(phase-b): clone or borrow io/config rather than moving - todo!("io clone"), - todo!("config clone"), - None, - None, - None, - )?; + let mut bitbucket_util = + Bitbucket::new(self.io.clone(), self.config.clone(), None, None, None)?; let password = auth .get("password") .and_then(|v| v.clone()) @@ -377,14 +359,8 @@ impl AuthHelper { "go over the API rate limit" }, ); - let mut bit_bucket_util = Bitbucket::new( - // TODO(phase-b): clone or borrow io/config rather than moving - todo!("io clone"), - todo!("config clone"), - None, - None, - None, - )?; + let mut bit_bucket_util = + Bitbucket::new(self.io.clone(), self.config.clone(), None, None, None)?; if !bit_bucket_util.authorize_oauth(&origin) && (!self.io.is_interactive() || !bit_bucket_util @@ -506,7 +482,7 @@ impl AuthHelper { } // PHP: $headers = &$options['http']['header']; - // TODO(phase-b): captured by reference; pushes below modify the same list + // The reference is emulated by writing `headers` back into options below. let mut headers: Vec = match options .get("http") .and_then(|v| v.as_array()) -- cgit v1.3.1