diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-22 11:07:42 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-22 11:15:29 +0900 |
| commit | 9f0d210021c54f63c9984446862b6ec68834bc63 (patch) | |
| tree | d1522b8047c60bc7ee7a9d832178dd24e1b07636 /crates/mozart/src/commands/bump.rs | |
| parent | 2c243a3cb814939bbe40fda1608781825ab0d77d (diff) | |
| download | php-mozart-9f0d210021c54f63c9984446862b6ec68834bc63.tar.gz php-mozart-9f0d210021c54f63c9984446862b6ec68834bc63.tar.zst php-mozart-9f0d210021c54f63c9984446862b6ec68834bc63.zip | |
refactor(async): migrate from blocking HTTP to async/await with tokio
Replace reqwest::blocking with async reqwest across the entire codebase.
All command execute functions, registry API calls (packagist, downloader,
resolver, lockfile), and the main entry point now use async/await with
the tokio runtime. The pubgrub resolver runs on spawn_blocking since its
DependencyProvider trait is synchronous, using Handle::block_on for
async I/O within that context.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/bump.rs')
| -rw-r--r-- | crates/mozart/src/commands/bump.rs | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/crates/mozart/src/commands/bump.rs b/crates/mozart/src/commands/bump.rs index af2809d..42b0d82 100644 --- a/crates/mozart/src/commands/bump.rs +++ b/crates/mozart/src/commands/bump.rs @@ -22,7 +22,7 @@ pub struct BumpArgs { // ─── Main entry point ───────────────────────────────────────────────────────── -pub fn execute( +pub async fn execute( args: &BumpArgs, cli: &super::Cli, console: &mozart_core::console::Console, @@ -324,8 +324,8 @@ mod tests { // ── Basic bump ───────────────────────────────────────────────────────── - #[test] - fn test_basic_bump_modifies_composer_json() { + #[tokio::test] + async fn test_basic_bump_modifies_composer_json() { let dir = tempdir().unwrap(); let composer_json = r#"{ "name": "test/project", @@ -351,7 +351,7 @@ mod tests { verbosity: mozart_core::console::Verbosity::Normal, decorated: false, }; - execute(&args, &cli, &console).unwrap(); + execute(&args, &cli, &console).await.unwrap(); let updated = std::fs::read_to_string(dir.path().join("composer.json")).unwrap(); let parsed: serde_json::Value = serde_json::from_str(&updated).unwrap(); @@ -360,8 +360,8 @@ mod tests { // ── Dry run ──────────────────────────────────────────────────────────── - #[test] - fn test_dry_run_does_not_modify_files() { + #[tokio::test] + async fn test_dry_run_does_not_modify_files() { let dir = tempdir().unwrap(); let composer_json = r#"{ "name": "test/project", @@ -387,7 +387,7 @@ mod tests { verbosity: mozart_core::console::Verbosity::Normal, decorated: false, }; - execute(&args, &cli, &console).unwrap(); + execute(&args, &cli, &console).await.unwrap(); // composer.json should be unchanged let content = std::fs::read_to_string(dir.path().join("composer.json")).unwrap(); @@ -397,8 +397,8 @@ mod tests { // ── No changes ───────────────────────────────────────────────────────── - #[test] - fn test_no_changes_when_already_bumped() { + #[tokio::test] + async fn test_no_changes_when_already_bumped() { let dir = tempdir().unwrap(); let composer_json = r#"{ "name": "test/project", @@ -424,7 +424,7 @@ mod tests { verbosity: mozart_core::console::Verbosity::Normal, decorated: false, }; - execute(&args, &cli, &console).unwrap(); + execute(&args, &cli, &console).await.unwrap(); // No changes should be made let content = std::fs::read_to_string(dir.path().join("composer.json")).unwrap(); @@ -434,8 +434,8 @@ mod tests { // ── Dev-only flag ────────────────────────────────────────────────────── - #[test] - fn test_dev_only_flag_only_bumps_require_dev() { + #[tokio::test] + async fn test_dev_only_flag_only_bumps_require_dev() { let dir = tempdir().unwrap(); let composer_json = r#"{ "name": "test/project", @@ -467,7 +467,7 @@ mod tests { verbosity: mozart_core::console::Verbosity::Normal, decorated: false, }; - execute(&args, &cli, &console).unwrap(); + execute(&args, &cli, &console).await.unwrap(); let content = std::fs::read_to_string(dir.path().join("composer.json")).unwrap(); let parsed: serde_json::Value = serde_json::from_str(&content).unwrap(); @@ -479,8 +479,8 @@ mod tests { // ── No-dev-only flag ─────────────────────────────────────────────────── - #[test] - fn test_no_dev_only_flag_only_bumps_require() { + #[tokio::test] + async fn test_no_dev_only_flag_only_bumps_require() { let dir = tempdir().unwrap(); let composer_json = r#"{ "name": "test/project", @@ -512,7 +512,7 @@ mod tests { verbosity: mozart_core::console::Verbosity::Normal, decorated: false, }; - execute(&args, &cli, &console).unwrap(); + execute(&args, &cli, &console).await.unwrap(); let content = std::fs::read_to_string(dir.path().join("composer.json")).unwrap(); let parsed: serde_json::Value = serde_json::from_str(&content).unwrap(); @@ -569,8 +569,8 @@ mod tests { // ── Lock file hash updated ───────────────────────────────────────────── - #[test] - fn test_lock_file_hash_updated_after_bump() { + #[tokio::test] + async fn test_lock_file_hash_updated_after_bump() { let dir = tempdir().unwrap(); let composer_json = r#"{ "name": "test/project", @@ -596,7 +596,7 @@ mod tests { verbosity: mozart_core::console::Verbosity::Normal, decorated: false, }; - execute(&args, &cli, &console).unwrap(); + execute(&args, &cli, &console).await.unwrap(); // The lock file content-hash should now match the updated composer.json let updated_composer = std::fs::read_to_string(dir.path().join("composer.json")).unwrap(); @@ -609,8 +609,8 @@ mod tests { // ── Package filter ───────────────────────────────────────────────────── - #[test] - fn test_package_filter_only_bumps_specified_packages() { + #[tokio::test] + async fn test_package_filter_only_bumps_specified_packages() { let dir = tempdir().unwrap(); let composer_json = r#"{ "name": "test/project", @@ -643,7 +643,7 @@ mod tests { verbosity: mozart_core::console::Verbosity::Normal, decorated: false, }; - execute(&args, &cli, &console).unwrap(); + execute(&args, &cli, &console).await.unwrap(); let content = std::fs::read_to_string(dir.path().join("composer.json")).unwrap(); let parsed: serde_json::Value = serde_json::from_str(&content).unwrap(); |
