aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command/self_update_command.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-22 01:29:48 +0900
committernsfisis <nsfisis@gmail.com>2026-05-22 01:43:48 +0900
commit0b06f54103490e3ce5658e82bbc0119633e26cd8 (patch)
tree687b075131d3679725e77e0931ff7c503a6c3034 /crates/shirabe/src/command/self_update_command.rs
parent2914770fba6b3cc03a68fae493f60470a41962ec (diff)
downloadphp-shirabe-0b06f54103490e3ce5658e82bbc0119633e26cd8.tar.gz
php-shirabe-0b06f54103490e3ce5658e82bbc0119633e26cd8.tar.zst
php-shirabe-0b06f54103490e3ce5658e82bbc0119633e26cd8.zip
refactor(composer): unify Composer/PartialComposer via Rc handles
Model PHP's `Composer extends PartialComposer` as a PartialOrFullComposer enum and merge partial_composer.rs into composer.rs. Introduce ComposerHandle / PartialComposerHandle (plus their Weak variants) so the graph can be shared, and build it at once with Rc::new_cyclic in the factory to resolve the back-reference cycles. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/self_update_command.rs')
-rw-r--r--crates/shirabe/src/command/self_update_command.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/shirabe/src/command/self_update_command.rs b/crates/shirabe/src/command/self_update_command.rs
index ccfbe07..8645ce1 100644
--- a/crates/shirabe/src/command/self_update_command.rs
+++ b/crates/shirabe/src/command/self_update_command.rs
@@ -20,7 +20,8 @@ use shirabe_php_shim::{
};
use crate::command::{BaseCommand, BaseCommandData, HasBaseCommandData};
-use crate::composer::Composer;
+use crate::composer;
+use crate::composer::ComposerHandle;
use crate::config::Config;
use crate::console::input::InputArgument;
use crate::console::input::InputOption;
@@ -280,7 +281,7 @@ impl SelfUpdateCommand {
.as_string()
.map(|s| s.to_string())
.unwrap_or_else(|| latest_version.clone());
- let current_major_version = Preg::replace(r"{^(\d+).*}", "$1", &Composer::get_version())?;
+ let current_major_version = Preg::replace(r"{^(\d+).*}", "$1", &composer::get_version())?;
let update_major_version = Preg::replace(r"{^(\d+).*}", "$1", &update_version)?;
let preview_major_version = Preg::replace(
r"{^(\d+).*}",
@@ -382,7 +383,7 @@ impl SelfUpdateCommand {
channel_string.push_str(".x");
}
- if Composer::VERSION == update_version.as_str() {
+ if composer::VERSION == update_version.as_str() {
io.write_error3(
&sprintf(
"<info>You are already using the latest available Composer version %s (%s channel).</info>",
@@ -414,11 +415,11 @@ impl SelfUpdateCommand {
"%s/%s-%s%s",
&[
PhpMixed::String(rollback_dir.clone()),
- PhpMixed::String(strtr(Composer::RELEASE_DATE, " :", "_-")),
+ PhpMixed::String(strtr(composer::RELEASE_DATE, " :", "_-")),
PhpMixed::String(Preg::replace(
r"{^([0-9a-f]{7})[0-9a-f]{33}$}",
"$1",
- &Composer::VERSION,
+ &composer::VERSION,
)?),
PhpMixed::String(Self::OLD_INSTALL_EXT.to_string()),
],
@@ -637,7 +638,7 @@ RGv89BPD+2DLnJysngsvVaUCAwEAAQ==\n\
io.write_error3(
&sprintf(
"Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>",
- &[PhpMixed::String(Composer::VERSION.to_string())],
+ &[PhpMixed::String(composer::VERSION.to_string())],
),
true,
io_interface::NORMAL,