Exemple #1
0
 /**
  * Execute command
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  * @return int
  * @throws Exception
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     try {
         $hooksDir = $this->getHooksDir($this->askProjectDir($input, $output));
         $files = $this->getTargetFiles();
         $status = $this->removeHookFiles($hooksDir, $files);
     } catch (Exception $e) {
         if ($this->isVeryVerbose()) {
             throw $e;
         } else {
             $output->writeln($e->getMessage());
             return 1;
         }
     }
     if ($status) {
         if ($this->isVerbose()) {
             $output->writeln("Existed CommitHook file(s) has been removed from '{$hooksDir}'.");
         } else {
             $output->writeln('Existed CommitHook file(s) has been removed.');
         }
     } else {
         $output->writeln('No CommitHook file(s) to remove.');
     }
     return 0;
 }
Exemple #2
0
 /**
  * Execute command
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  * @return int
  * @throws Exception
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     try {
         $hooksDir = $this->getHooksDir($this->askProjectDir($input, $output));
         $this->createHooks($hooksDir, $this->getTargetFiles(), $this->askPhpPath(), $this->getRunnerFile());
     } catch (Exception $e) {
         if ($this->isVeryVerbose()) {
             throw $e;
         } else {
             $output->writeln($e->getMessage());
             return 1;
         }
     }
     if ($this->isVerbose()) {
         $output->writeln("PHP CommitHook files have been created in '{$hooksDir}'.");
     } else {
         $output->writeln("PHP CommitHook files have been created.");
     }
     return 0;
 }