@@ -83,6 +83,14 @@ public static function getSubscribedEvents()
8383 */
8484 public function installOrUpdateFunction (PackageEvent $ event ): void
8585 {
86+ if ($ this ->isPluginDisabled ()) {
87+ $ this ->getIO ()->write (' <comment>plugin is disabled</comment> ' );
88+ return ;
89+ }
90+ if (getenv ('CI ' ) === 'true ' ) {
91+ $ this ->getIO ()->write (' <comment>disabling plugin due to CI-environment</comment> ' );
92+ return ;
93+ }
8694 // download phar and check signature
8795 parent ::installOrUpdateFunction ($ event );
8896 // try to configure and install hooks
@@ -100,16 +108,6 @@ public function configureHooks(): void
100108 $ this ->isPackageUpdate = true ;
101109 $ this ->getIO ()->write ('<info>CaptainHook</info> ' );
102110
103- if ($ this ->isPluginDisabled ()) {
104- $ this ->getIO ()->write (' <comment>plugin is disabled</comment> ' );
105- return ;
106- }
107-
108- if (getenv ('CI ' ) === 'true ' ) {
109- $ this ->getIO ()->write (' <comment>disabling plugin due to CI-environment</comment> ' );
110- return ;
111- }
112-
113111 $ this ->detectConfiguration ();
114112 $ this ->detectGitDir ();
115113 $ this ->detectCaptainExecutable ();
@@ -218,11 +216,11 @@ private function detectCaptainExecutable(): void
218216 {
219217 $ extra = $ this ->getComposer ()->getPackage ()->getExtra ();
220218 if (isset ($ extra ['captainhook ' ]['exec ' ])) {
221- $ this ->executable = $ extra ['captainhook ' ]['exec ' ];
219+ $ this ->executable = ( string ) $ extra ['captainhook ' ]['exec ' ];
222220 return ;
223221 }
224222
225- $ this ->executable = ( string ) $ this ->getComposer ()->getConfig ()->get ('bin-dir ' ) . '/captainhook ' ;
223+ $ this ->executable = $ this ->getComposer ()->getConfig ()->get ('bin-dir ' ) . '/captainhook ' ;
226224 }
227225
228226 /**
0 commit comments