Skip to content

Commit

Permalink
Merge pull request #158 from stellarwp/fix/default-to-composer2
Browse files Browse the repository at this point in the history
Default composer to version 2
  • Loading branch information
lucatume authored Mar 31, 2023
2 parents b6c0e0a + 3d8188d commit 0c9093f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.1] - 2023-03-31

* Change - Default to Composer version 2.

## [1.3.0] - 2023-03-30

* Change - Leverage Docker Compose syntax to manage network aliases and service dependencies. Clean up a remove code.
Expand Down
2 changes: 1 addition & 1 deletion slic.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
] );

$cli_name = 'slic';
const CLI_VERSION = '1.3.0';
const CLI_VERSION = '1.3.1';

// If the run-time option `-q`, for "quiet", is specified, then do not print the header.
if ( in_array( '-q', $argv, true ) || ( in_array( 'exec', $argv, true ) && ! in_array( 'help', $argv, true ) ) ) {
Expand Down
8 changes: 4 additions & 4 deletions src/commands/composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

ensure_service_running( 'slic' );

$default_version = 1;
$default_version = 2;
$command = $args( '...' );
$sub_command = $command[0] ?? null;
$current_version = getenv( 'SLIC_COMPOSER_VERSION' ) ?? $default_version;
Expand All @@ -64,11 +64,11 @@

exit( 0 );
case 'get-version':
$composer_bin = (int) $current_version === 2 ? 'composer' : 'composer1';
$composer_bin = (int) $current_version === 1 ? 'composer1' : 'composer';

exit( slic_realtime()( [ 'exec', 'slic', $composer_bin, '--version' ] ) );
case 'reset-version':
$version = 1;
$version = 2;
$run_settings_file = root( '/.env.slic.run' );
write_env_file( $run_settings_file, [ 'SLIC_COMPOSER_VERSION' => (int) $version ], true );
echo colorize( "Composer version reset to default: $default_version\n" );
Expand All @@ -77,7 +77,7 @@
}
}

$composer_bin = (int) $current_version === 2 ? 'composer' : 'composer1';
$composer_bin = (int) $current_version === 1 ? 'composer1' : 'composer';
$pool = build_command_pool( $composer_bin, $command, [ 'common' ] );
$status = execute_command_pool( $pool );

Expand Down

0 comments on commit 0c9093f

Please sign in to comment.