Skip to content

Commit

Permalink
Move disabled checks
Browse files Browse the repository at this point in the history
In order to really disable the plugin at the right point
the checks had to be moved.

This should fix issue #3
  • Loading branch information
Sebastian Feldmann committed Jul 27, 2021
1 parent 17b7fb6 commit 3477b73
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ public static function getSubscribedEvents()
*/
public function installOrUpdateFunction(PackageEvent $event): void
{
if ($this->isPluginDisabled()) {
$this->getIO()->write(' <comment>plugin is disabled</comment>');
return;
}
if (getenv('CI') === 'true') {
$this->getIO()->write(' <comment>disabling plugin due to CI-environment</comment>');
return;
}
// download phar and check signature
parent::installOrUpdateFunction($event);
// try to configure and install hooks
Expand All @@ -100,16 +108,6 @@ public function configureHooks(): void
$this->isPackageUpdate = true;
$this->getIO()->write('<info>CaptainHook</info>');

if ($this->isPluginDisabled()) {
$this->getIO()->write(' <comment>plugin is disabled</comment>');
return;
}

if (getenv('CI') === 'true') {
$this->getIO()->write(' <comment>disabling plugin due to CI-environment</comment>');
return;
}

$this->detectConfiguration();
$this->detectGitDir();
$this->detectCaptainExecutable();
Expand Down Expand Up @@ -218,11 +216,11 @@ private function detectCaptainExecutable(): void
{
$extra = $this->getComposer()->getPackage()->getExtra();
if (isset($extra['captainhook']['exec'])) {
$this->executable = $extra['captainhook']['exec'];
$this->executable = (string) $extra['captainhook']['exec'];
return;
}

$this->executable = (string) $this->getComposer()->getConfig()->get('bin-dir') . '/captainhook';
$this->executable = $this->getComposer()->getConfig()->get('bin-dir') . '/captainhook';
}

/**
Expand Down

0 comments on commit 3477b73

Please sign in to comment.