diff --git a/CHANGELOG.md b/CHANGELOG.md index 529bf17dd2947ce39cda696d0732ae0760cab1c9..61e122864c41f1a16f2359df083a2daef30da3d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.1.0] - 2021-08-16 +### Added +- no-dev option handling + ## [1.0.2] - 2021-08-12 ### Added - Popup diff --git a/src/ActivationReminder/Composer/Plugin.php b/src/ActivationReminder/Composer/Plugin.php index 8e2cd877243afbef14adbbf8bf9cfc3e09b3b172..98c63a3b2f1783c87877fc72c7a9ef61f61beef0 100644 --- a/src/ActivationReminder/Composer/Plugin.php +++ b/src/ActivationReminder/Composer/Plugin.php @@ -82,7 +82,9 @@ class Plugin implements PluginInterface, Capable, EventSubscriberInterface { * @param Event $event */ public function generateReminder(Event $event) { - passthru("composer prepare-activation-reminder" ); + global $argv; + $arg = in_array( '--no-dev', $argv, true ) ? '--no-dev' : ''; + passthru("composer prepare-activation-reminder $arg" ); } } diff --git a/src/ActivationReminder/Composer/PrepareActivationReminderCommand.php b/src/ActivationReminder/Composer/PrepareActivationReminderCommand.php index 62e0e3efe7063d0443f2536f39a664dfab5bde4e..5c12fda67c2b4589472be0558bf0e27b3075abea 100644 --- a/src/ActivationReminder/Composer/PrepareActivationReminderCommand.php +++ b/src/ActivationReminder/Composer/PrepareActivationReminderCommand.php @@ -19,7 +19,8 @@ class PrepareActivationReminderCommand extends BaseCommand { $this ->setName('prepare-activation-reminder') - ->setDescription('Prepares activation reminder for WP Desk plugin.'); + ->setDescription('Prepares activation reminder for WP Desk plugin.') + ->addOption( 'no-dev' ); } /** @@ -54,7 +55,7 @@ class PrepareActivationReminderCommand extends BaseCommand $this->prepare_class( $random_class . $random_letter, $target_file, $popup_javascript_file, $popup_css_file, $settings ); } - $this->regenerate_autoload( $target_file ); + $this->regenerate_autoload( $target_file, $input ); $output->writeln( "Activation reminder created." ); } @@ -74,8 +75,9 @@ class PrepareActivationReminderCommand extends BaseCommand /** * @param string $class_file + * @param InputInterface $input */ - private function regenerate_autoload( $class_file ) { + private function regenerate_autoload( $class_file, InputInterface $input ) { $composer = $this->getComposer(); $config = $composer->getConfig(); $localRepo = $composer->getRepositoryManager()->getLocalRepository(); @@ -88,7 +90,7 @@ class PrepareActivationReminderCommand extends BaseCommand $autoload['files'][] = $class_file; $package->setAutoload( $autoload ); - $composer->getAutoloadGenerator()->setDevMode( true ); + $composer->getAutoloadGenerator()->setDevMode( ! $input->getOption( 'no-dev' ) ); $composer->getAutoloadGenerator()->dump( $config, $localRepo, $package, $installationManager, 'composer', $optimize ); }