当前位置: 首页>>代码示例>>PHP>>正文


PHP Builder::log方法代码示例

本文整理汇总了PHP中PHPCI\Builder::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::log方法的具体用法?PHP Builder::log怎么用?PHP Builder::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPCI\Builder的用法示例。


在下文中一共展示了Builder::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Triggers Jenkins Build for the project
  */
 public function execute()
 {
     $success = true;
     if ($this->build->isSuccessful()) {
         // Builds the Jenkins trigger
         $jenkins = $this->jenkinsUrl . '/job/' . rawurlencode($this->jenkinsProject) . '/build?delay=0sec';
         if ($this->jenkinsToken && !empty($this->jenkinsToken)) {
             $jenkins .= '&token=%s';
         }
         $jenkins = sprintf($jenkins, rawurlencode($this->jenkinsProject), $this->jenkinsToken);
         $this->phpci->log($jenkins);
         $curlHandler = curl_init($jenkins);
         curl_setopt($curlHandler, CURLOPT_RETURNTRANSFER, 1);
         curl_exec($curlHandler);
         $status = curl_getinfo($curlHandler, CURLINFO_HTTP_CODE);
         $curlUrl = curl_getinfo($curlHandler, CURLINFO_EFFECTIVE_URL);
         curl_close($curlHandler);
         if ($status != '200') {
             $this->phpci->logFailure($curlUrl . ' return with status code ' . $status);
             return false;
         }
     } else {
         $this->phpci->log('Skipping due to failed Build');
     }
     return $success;
 }
开发者ID:kdemanuele,项目名称:PHPCI-Jenkins-Plugin,代码行数:29,代码来源:Jenkins.php

示例2: execute

 /**
  * Send a notification mail.
  */
 public function execute()
 {
     $addresses = $this->getEmailAddresses();
     // Without some email addresses in the yml file then we
     // can't do anything.
     if (count($addresses) == 0) {
         return false;
     }
     $buildStatus = $this->build->isSuccessful() ? "Passing Build" : "Failing Build";
     $projectName = $this->build->getProject()->getTitle();
     try {
         $view = $this->getMailTemplate();
     } catch (Exception $e) {
         $this->phpci->log(sprintf('Unknown mail template "%s", falling back to default.', $this->options['template']), LogLevel::WARNING);
         $view = $this->getDefaultMailTemplate();
     }
     $view->build = $this->build;
     $view->project = $this->build->getProject();
     $layout = new View('Email/layout');
     $layout->build = $this->build;
     $layout->project = $this->build->getProject();
     $layout->content = $view->render();
     $body = $layout->render();
     $sendFailures = $this->sendSeparateEmails($addresses, sprintf("PHPCI - %s - %s", $projectName, $buildStatus), $body);
     // This is a success if we've not failed to send anything.
     $this->phpci->log(sprintf("%d emails sent", count($addresses) - $sendFailures));
     $this->phpci->log(sprintf("%d emails failed to send", $sendFailures));
     return $sendFailures === 0;
 }
开发者ID:nelsonyang0710,项目名称:PHPCI,代码行数:32,代码来源:Email.php

示例3: execute

 /**
  * Connects to MySQL and runs a specified set of queries.
  */
 public function execute()
 {
     $addresses = $this->getEmailAddresses();
     // Without some email addresses in the yml file then we
     // can't do anything.
     if (count($addresses) == 0) {
         return false;
     }
     $subjectTemplate = "PHPCI - %s - %s";
     $projectName = $this->phpci->getBuildProjectTitle();
     $logText = $this->build->getLog();
     if ($this->build->isSuccessful()) {
         $sendFailures = $this->sendSeparateEmails($addresses, sprintf($subjectTemplate, $projectName, "Passing Build"), sprintf("Log Output: <br><pre>%s</pre>", $logText));
     } else {
         $view = new View('Email/failed');
         $view->build = $this->build;
         $view->project = $this->build->getProject();
         $emailHtml = $view->render();
         $sendFailures = $this->sendSeparateEmails($addresses, sprintf($subjectTemplate, $projectName, "Failing Build"), $emailHtml);
     }
     // This is a success if we've not failed to send anything.
     $this->phpci->log(sprintf("%d emails sent", count($addresses) - count($sendFailures)));
     $this->phpci->log(sprintf("%d emails failed to send", count($sendFailures)));
     return count($sendFailures) == 0;
 }
开发者ID:kukupigs,项目名称:PHPCI,代码行数:28,代码来源:Email.php

示例4: runConfigFile

 /**
  * Run tests from a Codeception config file.
  * @param $configPath
  * @return bool|mixed
  * @throws \Exception
  */
 protected function runConfigFile($configPath)
 {
     $this->phpci->logExecOutput(false);
     $codecept = $this->phpci->findBinary('codecept');
     if (!$codecept) {
         $this->phpci->logFailure(Lang::get('could_not_find', 'codecept'));
         return false;
     }
     $cmd = 'cd "%s" && ' . $codecept . ' run -c "%s" --xml ' . $this->args;
     if (IS_WIN) {
         $cmd = 'cd /d "%s" && ' . $codecept . ' run -c "%s" --xml ' . $this->args;
     }
     $configPath = $this->phpci->buildPath . $configPath;
     $success = $this->phpci->executeCommand($cmd, $this->phpci->buildPath, $configPath);
     $this->phpci->log('Codeception XML path: ' . $this->phpci->buildPath . $this->path . 'report.xml', Loglevel::DEBUG);
     $xml = file_get_contents($this->phpci->buildPath . $this->path . 'report.xml', false);
     $parser = new Parser($this->phpci, $xml);
     $output = $parser->parse();
     $meta = array('tests' => $parser->getTotalTests(), 'timetaken' => $parser->getTotalTimeTaken(), 'failures' => $parser->getTotalFailures());
     $this->build->storeMeta('codeception-meta', $meta);
     $this->build->storeMeta('codeception-data', $output);
     $this->build->storeMeta('codeception-errors', $parser->getTotalFailures());
     $this->phpci->logExecOutput(true);
     return $success;
 }
开发者ID:ntoniazzi,项目名称:PHPCI,代码行数:31,代码来源:Codeception.php

示例5: execute

 /**
  * Runs the copy command.
  *
  * @return bool
  */
 public function execute()
 {
     $destinationFilename = $this->phpci->buildPath . '/' . $this->envFilename;
     $this->phpci->log(sprintf('Copy external environment file %s for the %s branch to build directory', $this->envFilepath, $this->branch));
     if (!copy($this->envFilepath, $destinationFilename)) {
         $this->phpci->logFailure('Copy error environment file to build directory!');
         return false;
     }
     $this->phpci->logSuccess('External environment file successful copied.');
     return true;
 }
开发者ID:rephlux,项目名称:phpci-external-env,代码行数:16,代码来源:ExternalEnvironment.php

示例6: handleSymlink

 protected function handleSymlink(Builder $builder, $reference, $buildPath)
 {
     if (is_link($buildPath) && is_file($buildPath)) {
         unlink($buildPath);
     }
     $builder->log(sprintf('Symlinking: %s to %s', $reference, $buildPath));
     if (!symlink($reference, $buildPath)) {
         $builder->logFailure('Failed to symlink.');
         return false;
     }
     return true;
 }
开发者ID:kukupigs,项目名称:PHPCI,代码行数:12,代码来源:LocalBuild.php

示例7: execute

 /**
  * Runs the plugin
  */
 public function execute()
 {
     $success = true;
     $this->phpci->logExecOutput(false);
     $errorCount = $this->getErrorList();
     $this->phpci->log("Found {$errorCount} instances of " . implode(', ', $this->searches));
     $this->build->storeMeta('technical_debt-warnings', $errorCount);
     if ($this->allowed_errors != -1 && $errorCount > $this->allowed_errors) {
         $success = false;
     }
     return $success;
 }
开发者ID:zeus911,项目名称:PHPCI,代码行数:15,代码来源:TechnicalDebt.php

示例8: execute

 /**
  * Send a notification mail.
  */
 public function execute()
 {
     $addresses = $this->getEmailAddresses();
     // Without some email addresses in the yml file then we
     // can't do anything.
     if (count($addresses) == 0) {
         return false;
     }
     $buildStatus = $this->build->isSuccessful() ? "Passing Build" : "Failing Build";
     $projectName = $this->build->getProject()->getTitle();
     $mailTemplate = $this->build->isSuccessful() ? 'Email/success' : 'Email/failed';
     $view = new View($mailTemplate);
     $view->build = $this->build;
     $view->project = $this->build->getProject();
     $body = $view->render();
     $sendFailures = $this->sendSeparateEmails($addresses, sprintf("PHPCI - %s - %s", $projectName, $buildStatus), $body);
     // This is a success if we've not failed to send anything.
     $this->phpci->log(sprintf("%d emails sent", count($addresses) - $sendFailures));
     $this->phpci->log(sprintf("%d emails failed to send", $sendFailures));
     return $sendFailures === 0;
 }
开发者ID:stefanius,项目名称:phpci-box,代码行数:24,代码来源:Email.php

示例9: callDeploymentUrl

 /**
  * Calls the deployment url.
  *
  * @param string $deployUrl
  * @param string $method
  *
  * @return bool
  */
 protected function callDeploymentUrl($deployUrl, $method = 'get')
 {
     $curl = $this->getCurl();
     $this->phpci->log(sprintf('Calling remote deployment url %s with method (%s) on the %s branch', $deployUrl, $method, $this->branch));
     if ($method == 'GET') {
         $curl->get($deployUrl);
     }
     if ($method == 'POST') {
         $curl->post($deployUrl);
     }
     if ($curl->error) {
         $this->phpci->logFailure(sprintf('%s request to remote deployment url %s failed.', $method, $deployUrl));
         return false;
     }
     $this->phpci->logSuccess('Remote deployment request was successful.');
     return true;
 }
开发者ID:rephlux,项目名称:phpci-remote-deployment,代码行数:25,代码来源:RemoteDeployment.php

示例10: getErrorList

 /**
  * Gets the number and list of errors returned from the search
  *
  * @return array
  */
 public function getErrorList()
 {
     $dirIterator = new \RecursiveDirectoryIterator($this->directory);
     $iterator = new \RecursiveIteratorIterator($dirIterator, \RecursiveIteratorIterator::SELF_FIRST);
     $files = array();
     $ignores = $this->ignore;
     $ignores[] = 'phpci.yml';
     foreach ($iterator as $file) {
         $filePath = $file->getRealPath();
         $skipFile = false;
         foreach ($ignores as $ignore) {
             if (stripos($filePath, $ignore) !== false) {
                 $skipFile = true;
                 break;
             }
         }
         // Ignore hidden files, else .git, .sass_cache, etc. all get looped over
         if (stripos($filePath, '/.') !== false) {
             $skipFile = true;
         }
         if ($skipFile == false) {
             $files[] = $file->getRealPath();
         }
     }
     $files = array_filter(array_unique($files));
     $errorCount = 0;
     $data = array();
     foreach ($files as $file) {
         foreach ($this->searches as $search) {
             $fileContent = file_get_contents($file);
             $allLines = explode(PHP_EOL, $fileContent);
             $beforeString = strstr($fileContent, $search, true);
             if (false !== $beforeString) {
                 $lines = explode(PHP_EOL, $beforeString);
                 $lineNumber = count($lines);
                 $content = trim($allLines[$lineNumber - 1]);
                 $errorCount++;
                 $this->phpci->log("Found {$search} on line {$lineNumber} of {$file}:\n{$content}");
                 $fileName = str_replace($this->directory, '', $file);
                 $data[] = array('file' => $fileName, 'line' => $lineNumber, 'message' => $content);
                 $this->build->reportError($this->phpci, $fileName, $lineNumber, $content);
             }
         }
     }
     return array($errorCount, $data);
 }
开发者ID:nelsonyang0710,项目名称:PHPCI,代码行数:51,代码来源:TechnicalDebt.php

示例11: processReport

 /**
  * Process the PHPCS output report.
  * @param $output
  * @return array
  * @throws \Exception
  */
 protected function processReport($output)
 {
     $data = json_decode(trim($output), true);
     if (!is_array($data)) {
         $this->phpci->log($output);
         throw new \Exception(PHPCI\Helper\Lang::get('could_not_process_report'));
     }
     $errors = $data['totals']['errors'];
     $warnings = $data['totals']['warnings'];
     foreach ($data['files'] as $fileName => $file) {
         $fileName = str_replace($this->phpci->buildPath, '', $fileName);
         foreach ($file['messages'] as $message) {
             $this->build->reportError($this->phpci, 'php_code_sniffer', 'PHPCS: ' . $message['message'], $message['type'] == 'ERROR' ? BuildError::SEVERITY_HIGH : BuildError::SEVERITY_LOW, $fileName, $message['line']);
         }
     }
     return array($errors, $warnings);
 }
开发者ID:zeus911,项目名称:PHPCI,代码行数:23,代码来源:PhpCodeSniffer.php

示例12: processReport

 /**
  * Process PHPMD's XML output report.
  * @param $xmlString
  * @return array
  * @throws \Exception
  */
 protected function processReport($xmlString)
 {
     $xml = simplexml_load_string($xmlString);
     if ($xml === false) {
         $this->phpci->log($xmlString);
         throw new \Exception('Could not process PHPMD report XML.');
     }
     $warnings = 0;
     foreach ($xml->file as $file) {
         $fileName = (string) $file['name'];
         $fileName = str_replace($this->phpci->buildPath, '', $fileName);
         foreach ($file->violation as $violation) {
             $warnings++;
             $this->build->reportError($this->phpci, 'php_mess_detector', (string) $violation, PHPCI\Model\BuildError::SEVERITY_HIGH, $fileName, (int) $violation['beginline'], (int) $violation['endline']);
         }
     }
     return $warnings;
 }
开发者ID:zeus911,项目名称:PHPCI,代码行数:24,代码来源:PhpMessDetector.php

示例13: processReport

 protected function processReport($output)
 {
     $data = json_decode(trim($output), true);
     if (!is_array($data)) {
         $this->phpci->log($output);
         throw new \Exception('Could not process PHPCS report JSON.');
     }
     $errors = $data['totals']['errors'];
     $warnings = $data['totals']['warnings'];
     $rtn = array();
     foreach ($data['files'] as $fileName => $file) {
         $fileName = str_replace($this->phpci->buildPath, '', $fileName);
         foreach ($file['messages'] as $message) {
             $rtn[] = array('file' => $fileName, 'line' => $message['line'], 'type' => $message['type'], 'message' => $message['message']);
         }
     }
     return array($errors, $warnings, $rtn);
 }
开发者ID:kukupigs,项目名称:PHPCI,代码行数:18,代码来源:PhpCodeSniffer.php

示例14: processReport

 /**
  * Process the PHPCS output report.
  * @param $output
  * @return array
  * @throws \Exception
  */
 protected function processReport($output)
 {
     $data = json_decode(trim($output), true);
     if (!is_array($data)) {
         $this->phpci->log($output);
         throw new \Exception(PHPCI\Helper\Lang::get('could_not_process_report'));
     }
     $errors = $data['totals']['errors'];
     $warnings = $data['totals']['warnings'];
     $rtn = array();
     foreach ($data['files'] as $fileName => $file) {
         $fileName = str_replace($this->phpci->buildPath, '', $fileName);
         foreach ($file['messages'] as $message) {
             $this->build->reportError($this->phpci, $fileName, $message['line'], 'PHPCS: ' . $message['message']);
             $rtn[] = array('file' => $fileName, 'line' => $message['line'], 'type' => $message['type'], 'message' => $message['message']);
         }
     }
     return array($errors, $warnings, $rtn);
 }
开发者ID:nelsonyang0710,项目名称:PHPCI,代码行数:25,代码来源:PhpCodeSniffer.php

示例15: processReport

 /**
  * Process PHPMD's XML output report.
  * @param $xmlString
  * @return array
  * @throws \Exception
  */
 protected function processReport($xmlString)
 {
     $xml = simplexml_load_string($xmlString);
     if ($xml === false) {
         $this->phpci->log($xmlString);
         throw new \Exception('Could not process PHPMD report XML.');
     }
     $warnings = 0;
     $data = array();
     foreach ($xml->file as $file) {
         $fileName = (string) $file['name'];
         $fileName = str_replace($this->phpci->buildPath, '', $fileName);
         foreach ($file->violation as $violation) {
             $warnings++;
             $warning = array('file' => $fileName, 'line_start' => (int) $violation['beginline'], 'line_end' => (int) $violation['endline'], 'rule' => (string) $violation['rule'], 'ruleset' => (string) $violation['ruleset'], 'priority' => (int) $violation['priority'], 'message' => (string) $violation);
             $data[] = $warning;
         }
     }
     return array($warnings, $data);
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:26,代码来源:PhpMessDetector.php


注:本文中的PHPCI\Builder::log方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。