/** * Create coveralls configuration. * * @param array $options Processed configuration. * @param string $rootDir Path to project root directory. * @return \Contrib\Bundle\CoverallsV1Bundle\Config\Configuration */ protected function createConfiguration(array $options, $rootDir) { $configuration = new Configuration(); $file = new Path(); $repoToken = $options['repo_token']; $repoSecretToken = $options['repo_secret_token']; return $configuration->setRepoToken($repoToken !== null ? $repoToken : $repoSecretToken)->setServiceName($options['service_name'])->setSrcDir($this->ensureSrcDir($options['src_dir'], $rootDir, $file))->setCloverXmlPaths($this->ensureCloverXmlPaths($options['coverage_clover'], $rootDir, $file))->setJsonPath($this->ensureJsonPath($options['json_path'], $rootDir, $file))->setExcludeNoStatements($options['exclude_no_stmt']); }
public function __construct($paths) { $rootDir = getcwd(); $config = new Configuration(); $config->setSrcDir($rootDir); $this->setCloverPaths($paths); foreach ($this->getCloverPaths() as $path) { if (file_exists($path)) { $config->addCloverXmlPath($path); } else { $config->addCloverXmlPath($rootDir . DIRECTORY_SEPARATOR . $path); } } $this->api = new Jobs($config); }
/** * Fill repo_token for unsupported CI service. * * "COVERALLS_REPO_TOKEN" must be set. * * @return \Contrib\Bundle\CoverallsV1Bundle\Collector\CiEnvVarsCollector */ protected function fillRepoToken() { if ($this->config->hasRepoToken()) { $this->env['COVERALLS_REPO_TOKEN'] = $this->config->getRepoToken(); } return $this; }
protected function createConfiguration() { $config = new Configuration($this->rootDir); return $config->setSrcDir($this->srcDir)->addCloverXmlPath($this->cloverXmlPath); }
/** * Dump uploading json file. * * @param Configuration $config Configuration. * @return \Contrib\Bundle\CoverallsV1Bundle\Command\CoverallsV1JobsCommand */ protected function dumpJsonFile(Configuration $config) { $jsonPath = $config->getJsonPath(); $this->logger->info(sprintf('Dump uploading json file: %s', $jsonPath)); $this->api->dumpJsonFile(); $filesize = number_format(filesize($jsonPath) / 1024, 2); // kB $this->logger->info(sprintf('File size: <info>%s</info> kB', $filesize)); return $this; }