Skip to content
Snippets Groups Projects
Commit 7141867a authored by Grzegorz Rola's avatar Grzegorz Rola
Browse files

feature(no-dev): no-dev option handling

parent 77c53d1d
No related branches found
No related tags found
2 merge requests!6Feature/no dev,!5Feature/no dev
Pipeline #11457 passed
## [1.1.0] - 2021-08-16
### Added
- no-dev option handling
## [1.0.2] - 2021-08-12 ## [1.0.2] - 2021-08-12
### Added ### Added
- Popup - Popup
......
...@@ -82,7 +82,9 @@ class Plugin implements PluginInterface, Capable, EventSubscriberInterface { ...@@ -82,7 +82,9 @@ class Plugin implements PluginInterface, Capable, EventSubscriberInterface {
* @param Event $event * @param Event $event
*/ */
public function generateReminder(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" );
} }
} }
...@@ -19,7 +19,8 @@ class PrepareActivationReminderCommand extends BaseCommand ...@@ -19,7 +19,8 @@ class PrepareActivationReminderCommand extends BaseCommand
{ {
$this $this
->setName('prepare-activation-reminder') ->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 ...@@ -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->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." ); $output->writeln( "Activation reminder created." );
} }
...@@ -74,8 +75,9 @@ class PrepareActivationReminderCommand extends BaseCommand ...@@ -74,8 +75,9 @@ class PrepareActivationReminderCommand extends BaseCommand
/** /**
* @param string $class_file * @param string $class_file
* @param InputInterface $input
*/ */
private function regenerate_autoload( $class_file ) { private function regenerate_autoload( $class_file, InputInterface $input ) {
$composer = $this->getComposer(); $composer = $this->getComposer();
$config = $composer->getConfig(); $config = $composer->getConfig();
$localRepo = $composer->getRepositoryManager()->getLocalRepository(); $localRepo = $composer->getRepositoryManager()->getLocalRepository();
...@@ -88,7 +90,7 @@ class PrepareActivationReminderCommand extends BaseCommand ...@@ -88,7 +90,7 @@ class PrepareActivationReminderCommand extends BaseCommand
$autoload['files'][] = $class_file; $autoload['files'][] = $class_file;
$package->setAutoload( $autoload ); $package->setAutoload( $autoload );
$composer->getAutoloadGenerator()->setDevMode( true ); $composer->getAutoloadGenerator()->setDevMode( ! $input->getOption( 'no-dev' ) );
$composer->getAutoloadGenerator()->dump( $config, $localRepo, $package, $installationManager, 'composer', $optimize ); $composer->getAutoloadGenerator()->dump( $config, $localRepo, $package, $installationManager, 'composer', $optimize );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment