コード例 #1
0
 public function configure()
 {
     if (!$this->isEnabled()) {
         return;
     }
     $default = $this->settings->getDefaultValueFor('phpSrcPath', array('src'));
     $this->settings['phpSrcPath'] = $this->multiplePathHelper->askPaths("At which paths is the PHP source code located?", implode(',', $default));
 }
コード例 #2
0
 /**
  * Asks user what the path to Php source is.
  */
 public function configure()
 {
     $default = $this->settings->getDefaultValueFor('enablePhpTools', true);
     $this->settings['enablePhpTools'] = $this->dialog->askConfirmation($this->output, "\nDo you want to install the QA tools for PHP?", $default);
     if ($this->settings['enablePhpTools']) {
         $this->output->writeln("\n<info>Configuring PHP inspections</info>\n");
     }
 }
コード例 #3
0
 public function configure()
 {
     if (!$this->settings['enablePhpTools']) {
         $this->settings['enableComposer'] = false;
         return false;
     }
     $this->settings['enableComposer'] = $this->dialog->askConfirmation($this->output, "Do you want to run `./composer.phar install` on every commit?", $this->settings->getDefaultValueFor('enableComposer', false));
 }
コード例 #4
0
 /**
  *
  */
 public function configure()
 {
     if (!$this->settings['enablePhpTools']) {
         $this->settings['enablePhpLint'] = false;
         return false;
     }
     $default = $this->settings->getDefaultValueFor('enablePhpLint', true);
     $this->settings['enablePhpLint'] = $this->dialog->askConfirmation($this->output, "Do you want to enable PHP Lint?", $default);
 }
コード例 #5
0
 public function configure()
 {
     if (!$this->settings['enablePhpTools']) {
         $this->settings['enablePhpSecurityChecker'] = false;
         return false;
     }
     $default = $this->settings->getDefaultValueFor('enablePhpSecurityChecker', true);
     $this->settings['enablePhpSecurityChecker'] = $this->dialog->askConfirmation($this->output, "Do you want to enable the Sensiolabs Security Checker?", $default);
 }
コード例 #6
0
 public function configure()
 {
     if (!$this->settings['enablePhpTools']) {
         $this->settings['enablePhpMessDetector'] = false;
         return false;
     }
     $default = $this->settings->getDefaultValueFor('enablePhpMessDetector', true);
     $this->settings['enablePhpMessDetector'] = $this->dialog->askConfirmation($this->output, "Do you want to enable the PHP Mess Detector?", $default);
     // Exclude default patterns
     $default = $this->settings->getDefaultValueFor('phpMdExcludePatterns', array());
     $excludePatterns = $this->multiplePathHelper->askPatterns("  - Which patterns should be excluded for PHP Mess Detector?", implode(',', $default), "  - Do you want to exclude custom patterns for PHP Mess Detector?", !empty($default));
     $this->settings['phpMdExcludePatterns'] = $excludePatterns;
 }
コード例 #7
0
 /**
  * Asks user what the path to javascript source is.
  */
 public function configure()
 {
     if (!$this->settings['enableJsHint']) {
         return;
     }
     $baseDir = $this->settings->getBaseDir();
     $default = $this->settings->getDefaultValueFor('javaScriptSrcPath', 'src');
     $this->settings['javaScriptSrcPath'] = $this->dialog->askAndValidate($this->output, "What is the path to the JavaScript source code? [{$default}] ", function ($data) use($baseDir) {
         if (is_dir($baseDir . '/' . $data)) {
             return $data;
         }
         throw new \Exception("That path doesn't exist");
     }, false, $default);
 }
コード例 #8
0
 public function configure()
 {
     if (!$this->settings['enablePhpTools']) {
         $this->settings['enablePhpCopyPasteDetection'] = false;
         return;
     }
     $default = $this->settings->getDefaultValueFor('enablePhpCopyPasteDetection', false);
     $this->settings['enablePhpCopyPasteDetection'] = $this->dialog->askConfirmation($this->output, "Do you want to enable PHP Copy Paste Detection?", $default);
     if (!$this->settings['enablePhpCopyPasteDetection']) {
         return;
     }
     // Tests is the Symfony default
     $default = $this->settings->getDefaultValueFor('phpCpdExcludePatterns', 'Tests');
     $this->settings['phpCpdExcludePatterns'] = $this->multiplePathHelper->askPatterns(" - Which patterns should be excluded for PHP Copy Paste detection?", $default, " - Do you want to exclude patterns for PHP Copy Paste detection?");
 }
コード例 #9
0
 /**
  * Asks if the user wants to exclude any other paths
  *
  * @param array $symfonyPatterns
  */
 protected function askExcludePatterns(array $symfonyPatterns)
 {
     // Exclude default patterns
     $default = $this->settings->getDefaultValueFor('phpCsExcludeCustomPatterns', false);
     $this->settings['phpCsExcludeCustomPatterns'] = $this->multiplePathHelper->askPatterns("  - Which patterns should be excluded for PHP Code Sniffer?", '', "  - Do you want to exclude some custom patterns for PHP Code Sniffer?", $default);
     $this->settings['phpCsExcludePatterns'] = array_merge($symfonyPatterns, $this->settings['phpCsExcludeCustomPatterns']);
 }
コード例 #10
0
 public function configure()
 {
     if (!$this->settings['enableJsTools']) {
         $this->settings['enableJsHint'] = false;
         return;
     }
     $default = $this->settings->getDefaultValueFor('enableJsHint', true);
     $this->settings['enableJsHint'] = $this->dialog->askConfirmation($this->output, "Do you want to enable JSHint?", $default);
     if ($this->settings['enableJsHint'] === false) {
         return;
     }
     $statusCode = $this->installJsHintCommand->run($this->input, $this->output);
     if ($statusCode) {
         $this->settings['enableJsHint'] = false;
     }
 }
コード例 #11
0
 /**
  * Ask Base url for an different environment environment
  *
  * @param OutputInterface $output
  * @param string          $environment
  */
 protected function askBaseDifferentEnvironment(OutputInterface $output, $environment)
 {
     $default = $this->settings->getDefaultValueFor('baseUrl' . $environment, $this->suggestDomain($this->settings['baseUrl'], strtolower($environment)));
     $this->settings['baseUrl' . $environment] = $this->dialog->askAndValidate($output, "What is base url of the " . strtolower($environment) . " environment? [{$default}] ", function ($data) {
         if (substr($data, 0, 4) == 'http') {
             return $data;
         }
         throw new \Exception("Url needs to start with http");
     }, false, $default);
 }
コード例 #12
0
 /**
  * @return string
  */
 private function askSlackToken()
 {
     $question = "Please paste your slack credentials \n" . "  (see http://docs.travis-ci.com/user/notifications/#Slack-notifications): \n";
     // very basic validation
     $validator = function ($token) {
         // we must have a string, that contains a : not at the starting position
         // token format is username:hashedtoken
         if (is_string($token) && strpos($token, ':')) {
             return $token;
         }
         throw new \Exception("Please enter a valid token");
     };
     return $this->dialog->askAndValidate($this->output, $question, $validator, false, $this->settings->getDefaultValueFor('travis.slack.token', null));
 }
コード例 #13
0
 /**
  * @param OutputInterface $output
  * @param Settings $settings
  * @return bool
  */
 protected function enablePhpUnitAutoLoad(OutputInterface $output, Settings $settings)
 {
     $default = $this->settings->getDefaultValueFor('enablePhpUnitAutoload', true);
     $settings['enablePhpUnitAutoload'] = $this->dialog->askConfirmation($output, "Do you want to enable an autoload script for PHPUnit?", $default);
     if (false === $settings['enablePhpUnitAutoload']) {
         return false;
     }
     if ($settings['enablePhpUnitAutoload']) {
         $default = $this->settings->getDefaultValueFor('phpUnitAutoloadPath', 'vendor/autoload.php');
         $settings['phpUnitAutoloadPath'] = $this->dialog->askAndValidate($output, "What is the path to the autoload script for PHPUnit? [{$default}] ", function ($data) use($settings) {
             if (file_exists($settings->getBaseDir() . '/' . $data)) {
                 return $data;
             }
             throw new \Exception("That path doesn't exist");
         }, false, $default);
     }
     return true;
 }
コード例 #14
0
 /**
  * Asks user what the path to javascript source is.
  */
 public function configure()
 {
     $default = $this->settings->getDefaultValueFor('enableJsTools', true);
     $this->settings['enableJsTools'] = $this->dialog->askConfirmation($this->output, "\nDo you want to install the QA tools for Javascript?", $default);
 }
コード例 #15
0
 /**
  * @return string
  */
 private function askArtifactWritePath()
 {
     $default = $this->settings->getDefaultValueFor('buildArtifacts.path', self::DEFAULT_ARTIFACT_PATH);
     return $this->dialog->askAndValidate($this->output, sprintf('Where do you want to store the build artifacts? [%s] ', $default), array($this, 'validateArtifactWritePath'), false, $default);
 }