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/repository_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/repository_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/repository_command.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/crates/shirabe/src/command/repository_command.rs b/crates/shirabe/src/command/repository_command.rs index 5ced013..975dd32 100644 --- a/crates/shirabe/src/command/repository_command.rs +++ b/crates/shirabe/src/command/repository_command.rs @@ -25,7 +25,7 @@ pub struct RepositoryCommand { base_command_data: BaseCommandData, config: Option<std::rc::Rc<std::cell::RefCell<Config>>>, - config_file: Option<JsonFile>, + config_file: Option<std::rc::Rc<std::cell::RefCell<JsonFile>>>, config_source: Option<JsonConfigSource>, } @@ -95,8 +95,14 @@ impl RepositoryCommand { .as_string() .map(|s| s.to_string()); - let config_data = self.config_file.as_mut().unwrap().read()?; - let config_file_path = self.config_file.as_ref().unwrap().get_path().to_string(); + let config_data = self.config_file.as_ref().unwrap().borrow_mut().read()?; + let config_file_path = self + .config_file + .as_ref() + .unwrap() + .borrow() + .get_path() + .to_string(); let config_data_map: IndexMap<String, PhpMixed> = match config_data { PhpMixed::Array(m) => m.into_iter().map(|(k, v)| (k, *v)).collect(), _ => IndexMap::new(), @@ -416,14 +422,10 @@ impl BaseConfigCommand for RepositoryCommand { &mut self.config } - fn config_file(&self) -> Option<&JsonFile> { + fn config_file(&self) -> Option<&std::rc::Rc<std::cell::RefCell<JsonFile>>> { self.config_file.as_ref() } - fn config_file_mut(&mut self) -> Option<&mut JsonFile> { - self.config_file.as_mut() - } - fn config_source(&self) -> Option<&JsonConfigSource> { self.config_source.as_ref() } @@ -432,7 +434,7 @@ impl BaseConfigCommand for RepositoryCommand { self.config_source.as_mut() } - fn set_config_file(&mut self, file: Option<JsonFile>) { + fn set_config_file(&mut self, file: Option<std::rc::Rc<std::cell::RefCell<JsonFile>>>) { self.config_file = file; } |
