diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-07 10:33:53 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-07 10:33:53 +0900 |
| commit | 971824aa15334fd12d08ae0f441f6bf6079344c3 (patch) | |
| tree | d59892042f478c65d980d96f62ef633644fd8fea /crates/shirabe/src/command/show_command.rs | |
| parent | 0d45c403c20ac8950f2877a21f9cd4f0ca9bf784 (diff) | |
| download | php-shirabe-971824aa15334fd12d08ae0f441f6bf6079344c3.tar.gz php-shirabe-971824aa15334fd12d08ae0f441f6bf6079344c3.tar.zst php-shirabe-971824aa15334fd12d08ae0f441f6bf6079344c3.zip | |
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<RefCell<JsonFile>> 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
Diffstat (limited to 'crates/shirabe/src/command/show_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/show_command.rs | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/crates/shirabe/src/command/show_command.rs b/crates/shirabe/src/command/show_command.rs index 859ba97..4f771a8 100644 --- a/crates/shirabe/src/command/show_command.rs +++ b/crates/shirabe/src/command/show_command.rs @@ -373,11 +373,7 @@ impl ShowCommand { locked_repo = Some(lr_handle); } else { // --installed / default case - // TODO(phase-b): PHP shares the Composer object by reference. Phase B - // can't clone Composer, so we re-fetch via require_composer when missing - // but otherwise borrow the existing Option. let composer_local_owned; - // Borrow guards that keep the Ref alive for the duration of the block. let _guard_from_existing; let composer_local = match composer.as_ref() { Some(c) => { @@ -1084,11 +1080,14 @@ impl ShowCommand { } } if write_path { - // TODO(phase-b): get_installation_manager wants &mut Composer; PHP shares by ref. - let path: Option<String> = { - let _ = composer.as_ref().unwrap(); - None - }; + let installation_manager = composer + .as_ref() + .unwrap() + .borrow_partial() + .get_installation_manager(); + let path: Option<String> = installation_manager + .borrow_mut() + .get_install_path(package.clone()); if let Some(p) = path { let r = realpath(&p).unwrap_or_default(); let trimmed = @@ -1702,11 +1701,12 @@ impl ShowCommand { package.get_dist_reference().unwrap_or_default() )); if is_installed_package { - // TODO(phase-b): get_installation_manager wants &mut Composer; PHP shares by ref. - // Skipping the install path lookup keeps compile clean. let path: Option<String> = self.require_composer(None, None).ok().and_then(|c| { - let _ = c; - None::<String> + let installation_manager = c.borrow_partial().get_installation_manager(); + let p = installation_manager + .borrow_mut() + .get_install_path(package.clone().into()); + p }); if let Some(p) = path { self.get_io().write(&format!( @@ -1982,9 +1982,11 @@ impl ShowCommand { if !PlatformRepository::is_platform_package(&package.get_name()) && installed_repo.has_package(package.clone().into()) { - // TODO(phase-b): get_installation_manager wants &mut Composer; PHP shares by ref. - let _ = self.require_composer(None, None)?; - let path: Option<String> = None; + let composer = self.require_composer(None, None)?; + let installation_manager = composer.borrow_partial().get_installation_manager(); + let path: Option<String> = installation_manager + .borrow_mut() + .get_install_path(package.clone().into()); match path { Some(p) => { if let Some(r) = realpath(&p) { |
