aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command/remove_command.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-07 10:33:53 +0900
committernsfisis <nsfisis@gmail.com>2026-06-07 10:33:53 +0900
commit971824aa15334fd12d08ae0f441f6bf6079344c3 (patch)
treed59892042f478c65d980d96f62ef633644fd8fea /crates/shirabe/src/command/remove_command.rs
parent0d45c403c20ac8950f2877a21f9cd4f0ca9bf784 (diff)
downloadphp-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/remove_command.rs')
-rw-r--r--crates/shirabe/src/command/remove_command.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/shirabe/src/command/remove_command.rs b/crates/shirabe/src/command/remove_command.rs
index 2cf71e7..c2a358b 100644
--- a/crates/shirabe/src/command/remove_command.rs
+++ b/crates/shirabe/src/command/remove_command.rs
@@ -270,7 +270,10 @@ impl RemoveCommand {
let composer_backup = std::fs::read_to_string(json_file.get_path())?;
let json_file_for_source = JsonFile::new(file.clone(), None, None)?;
- let mut json = JsonConfigSource::new(json_file_for_source, false);
+ let mut json = JsonConfigSource::new(
+ std::rc::Rc::new(std::cell::RefCell::new(json_file_for_source)),
+ false,
+ );
let r#type = if input.borrow().get_option("dev").as_bool().unwrap_or(false) {
"require-dev"
@@ -464,7 +467,6 @@ impl RemoveCommand {
let mut composer = crate::command::composer_full_mut(&composer_handle);
if dry_run {
- // TODO(phase-b): composer.get_package() returns &dyn RootPackageInterface; set_requires/set_dev_requires need &mut self; needs shared-ownership refactor
let root_package = composer.get_package();
let mut links: IndexMap<String, IndexMap<String, _>> = IndexMap::new();
links.insert("require".to_string(), root_package.get_requires().clone());
@@ -479,10 +481,8 @@ impl RemoveCommand {
}
}
}
- let _ = links.remove("require").unwrap_or_default();
- let _ = links.remove("require-dev").unwrap_or_default();
- // root_package.set_requires(links.remove("require").unwrap_or_default().into_values().collect());
- // root_package.set_dev_requires(links.remove("require-dev").unwrap_or_default().into_values().collect());
+ root_package.set_requires(links.remove("require").unwrap_or_default());
+ root_package.set_dev_requires(links.remove("require-dev").unwrap_or_default());
}
// TODO(plugin): dispatch CommandEvent(PluginEvents::COMMAND, 'remove', input, output)