diff --git a/composer.json b/composer.json index 8bccc6e..fa2f798 100644 --- a/composer.json +++ b/composer.json @@ -8,12 +8,13 @@ "email": "technical@beapi.fr" } ], + "minimum-stability": "dev", "require": { "php": ">=5.6", - "composer-plugin-api": "^1.1" + "composer-plugin-api": "^1.0 || ^2.0" }, "require-dev": { - "composer/composer": "^1.4" + "composer/composer": "^2.0" }, "autoload": { "psr-4": { diff --git a/src/Command/MakeStableCommand.php b/src/Command/MakeStableCommand.php index ebd1187..cb06c52 100644 --- a/src/Command/MakeStableCommand.php +++ b/src/Command/MakeStableCommand.php @@ -26,23 +26,23 @@ protected function execute( InputInterface $input, OutputInterface $output ) { $output->writeln( "Before proceeding please make sure all your requires have the appropriate minimum stability & some releases !" ); if ( false === $io->askConfirmation( - "Do you really want to set all requires as \"*@stable\" version ?", + "Do you really want to set all requires as \"*@stable\" version (y/n) ? ", true ) ) { - exit; + return 0; } $composerPath = $composer->getConfig()->getConfigSource()->getName(); $composerFile = new JsonFile( $composerPath ); if ( ! $composerFile->exists() ) { $output->writeln( "Composer file not found." ); - exit; + return 1; } // if we cannot write then bail - if ( ! is_writeable( $composerPath ) ) { + if ( ! is_writable( $composerPath ) ) { $output->writeln( "The composer.json file cannot be rewritten !" ); $output->writeln( "Please check your file permissions." ); - exit; + return 1; } try { @@ -69,10 +69,11 @@ protected function execute( InputInterface $input, OutputInterface $output ) { $composerFile->write( $composerJson ); $output->writeln( "All requires are now at \"*@stable\" version \o/" ); + return 0; } catch ( RuntimeException $e ) { $output->writeln( "An error occurred" ); $output->writeln( sprintf( "%s", $e->getMessage() ) ); - exit; + return 1; } } } diff --git a/src/MakeStable.php b/src/MakeStable.php index 85b7e48..a6f1035 100644 --- a/src/MakeStable.php +++ b/src/MakeStable.php @@ -26,10 +26,14 @@ public function activate(Composer $composer, IOInterface $io) $this->io = $io; } - public function getCapabilities() + public function deactivate( Composer $composer, IOInterface $io ) {} + + public function uninstall( Composer $composer, IOInterface $io ) {} + + public function getCapabilities() { return [ - 'Composer\Plugin\Capability\CommandProvider' => __NAMESPACE__ . '\\MakeStable', + CommandProvider::class => __CLASS__, ]; }