diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-12 07:01:55 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-15 09:27:59 +0900 |
| commit | 592ab8b1a2d73a1f77db8a7b7e17238ce3577030 (patch) | |
| tree | ccd0e3d550c9591557a84112f110bea355cb7444 /crates/shirabe/src/console | |
| parent | bb4684f7d1c51bc1be9c1bda1b00cb52c839cd25 (diff) | |
| download | php-shirabe-592ab8b1a2d73a1f77db8a7b7e17238ce3577030.tar.gz php-shirabe-592ab8b1a2d73a1f77db8a7b7e17238ce3577030.tar.zst php-shirabe-592ab8b1a2d73a1f77db8a7b7e17238ce3577030.zip | |
feat(cli): report Shirabe's own identity instead of Composer's
The binary called itself Composer everywhere: the application name, the
logo, --version, about, and every warning that talks about the running
program. Prompts to file a bug also pointed at Composer's issue tracker.
Add SHIRABE_VERSION and SHIRABE_RELEASE_DATE next to the Composer version
constants and report those, naming the Composer version this port tracks
alongside them. Composer::VERSION and getVersion() are untouched, so the
composer platform package, composer-runtime-api and the HTTP User-Agent
keep the value plugins and package repositories expect.
build.rs stamps the release date with the UTC date of the HEAD commit,
the way Composer's Compiler fills in @release_date@ when building the
phar. It now also fails the build when git cannot be read, instead of
letting COMPOSER_DEV_WARNING_TIME fall back to the tagged-release value
and suppress the outdated-build warning forever.
Messages about the Composer ecosystem keep their wording. Two of them are
pinned by upstream installer fixtures (Rule's "cannot be modified by
Composer" and SolverProblemsException's "you can run Composer with") and
stay as they are so those fixtures can keep being used verbatim.
The e2e list comparison against upstream Composer now skips the banner,
which cannot match by design, and compares everything below it as before.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/console')
| -rw-r--r-- | crates/shirabe/src/console/application.rs | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs index 9bb810f7..3e4a746b 100644 --- a/crates/shirabe/src/console/application.rs +++ b/crates/shirabe/src/console/application.rs @@ -141,17 +141,16 @@ pub struct Application { } impl Application { - const LOGO: &'static str = r#" ______ - / ____/___ ____ ___ ____ ____ ________ _____ - / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ -/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / -\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ - /_/ + const LOGO: &'static str = r#" _____ __ _ __ + / ___// /_ (_)________ _/ /_ ___ + \__ \/ __ \/ / ___/ __ `/ __ \/ _ \ + ___/ / / / / / / / /_/ / /_/ / __/ +/____/_/ /_/_/_/ \__,_/_.___/\___/ "#; pub fn new(name: String, mut version: String) -> Self { if version.is_empty() { - version = composer::get_version(); + version = composer::SHIRABE_VERSION.to_string(); } if function_exists("ini_set") && extension_loaded("xdebug") { ini_set("xdebug.show_exception_trace", "0"); @@ -525,11 +524,12 @@ impl Application { } format!( - "<info>{}</info> version <comment>{}{}</comment> {}", + "<info>{}</info> version <comment>{}{}</comment> (based on Composer {}) {}", self.get_name(), self.get_version(), branch_alias_string, - composer::RELEASE_DATE, + composer::VERSION, + composer::SHIRABE_RELEASE_DATE, ) } @@ -2176,7 +2176,7 @@ impl ApplicationHandle { // at this point plugins are needed, so if we are running as root and it is not allowed we need to prompt // if interactive, and abort otherwise if is_non_allowed_root { - io.write_error("<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>"); + io.write_error("<warning>Do not run Shirabe as root/super user! See https://getcomposer.org/root for details</warning>"); if io.is_interactive() && io.ask_confirmation( @@ -2200,7 +2200,7 @@ impl ApplicationHandle { let cmd_name = command.borrow().get_name().unwrap_or_default(); if application.borrow_mut().has(&cmd_name) { let cls = command.borrow().php_class_name(); - io.write_error(&format!("<warning>Plugin command {} ({}) would override a Composer command and has been skipped</warning>", cmd_name, cls)); + io.write_error(&format!("<warning>Plugin command {} ({}) would override a Shirabe command and has been skipped</warning>", cmd_name, cls)); } else { self.add(command)?; } @@ -2259,9 +2259,10 @@ impl ApplicationHandle { if !is_proxy_command { io.write_error3( &format!( - "Running {} ({}) with PHP {} on {}", - composer::get_version(), - composer::RELEASE_DATE, + "Running Shirabe {} ({}, based on Composer {}) with PHP {} on {}", + composer::SHIRABE_VERSION, + composer::SHIRABE_RELEASE_DATE, + composer::VERSION, shirabe_php_rpc::get_php_version().version, (if function_exists("php_uname") { format!("{} / {}", php_uname("s"), php_uname("r")) @@ -2274,13 +2275,13 @@ impl ApplicationHandle { ); if shirabe_php_rpc::get_php_version().version_id < 70205 { - io.write_error(&format!("<warning>Composer supports PHP 7.2.5 and above, you will most likely encounter problems with your PHP {}. Upgrading is strongly recommended but you can use Composer 2.2.x LTS as a fallback.</warning>", shirabe_php_rpc::get_php_version().version)); + io.write_error(&format!("<warning>Shirabe supports PHP 7.2.5 and above, you will most likely encounter problems with your PHP {}. Upgrading is strongly recommended but you can use Composer 2.2.x LTS as a fallback.</warning>", shirabe_php_rpc::get_php_version().version)); } if shirabe_php_rpc::xdebug::is_xdebug_active() && Platform::get_env("COMPOSER_DISABLE_XDEBUG_WARN").is_none() { - io.write_error("<warning>Composer is operating slower than normal because you have Xdebug enabled. See https://getcomposer.org/xdebug</warning>"); + io.write_error("<warning>Shirabe is operating slower than normal because you have Xdebug enabled. See https://getcomposer.org/xdebug</warning>"); } let dev_warning_time = application.borrow().dev_warning_time; @@ -2290,7 +2291,7 @@ impl ApplicationHandle { && time() > dev_warning_time { io.write_error(&format!( - "<warning>Warning: This development build of Composer is over 60 days old. It is recommended to update it by running \"{} self-update\" to get the latest version.</warning>", + "<warning>Warning: This development build of Shirabe is over 60 days old. It is recommended to update it by running \"{} self-update\" to get the latest version.</warning>", shirabe_php_shim::PHP_SERVER .lock() .unwrap() @@ -2305,7 +2306,7 @@ impl ApplicationHandle { && command_name.as_deref() != Some("selfupdate") && command_name.as_deref() != Some("_complete") { - io.write_error("<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>"); + io.write_error("<warning>Do not run Shirabe as root/super user! See https://getcomposer.org/root for details</warning>"); if io.is_interactive() && !io.ask_confirmation( @@ -2336,7 +2337,7 @@ impl ApplicationHandle { && unlink(&tempfile).is_ok() && !file_exists(&tempfile)) { - return Ok(Some(format!("<error>PHP temp directory ({}) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>", sys_get_temp_dir()))); + return Ok(Some(format!("<error>PHP temp directory ({}) does not exist or is not writable to Shirabe. Set sys_temp_dir in your php.ini</error>", sys_get_temp_dir()))); } Ok(None) }) @@ -2362,7 +2363,7 @@ impl ApplicationHandle { ); if !defined(&script_event_const) { if application.borrow_mut().has(script) { - io.write_error(&format!("<warning>A script named {} would override a Composer command and has been skipped</warning>", script)); + io.write_error(&format!("<warning>A script named {} would override a Shirabe command and has been skipped</warning>", script)); } else { let mut description = format!( "Runs the {} script as defined in composer.json", |
