Пример #1
0
 protected function execute(array $arguments = array(), array $options = array())
 {
     $this->logLine('Running tests', nbLogger::COMMENT);
     $command = '"' . $arguments['testapp'] . '" ';
     if (isset($options['output'])) {
         $command .= '--gtest_output=xml:' . $options['output'] . ' ';
         $testResultDir = dirname(nbConfig::get('project_testresult'));
         nbFileSystem::rmdir($testResultDir, true);
         nbFileSystem::mkdir($testResultDir, true);
     }
     //    if(isset($options['nocolor']))
     //      $command .= '--gtest_color=no ';
     $this->executeShellCommand($command);
 }
Пример #2
0
 protected function execute(array $arguments = array(), array $options = array())
 {
     nbFileSystem::rmdir(nbConfig::get('project_dependencies'), true);
     $client = new nbIvyClient();
     $this->logLine('Retrieving dependencies...', nbLogger::COMMENT);
     $command = $client->getRetrieveCmdLine();
     $this->executeShellCommand($command);
     $finder = nbFileFinder::create('file');
     $files = $finder->add('*-api.zip')->in(nbConfig::get('project_dependencies'));
     $zip = new ZipArchive();
     foreach ($files as $file) {
         if ($zip->open($file, ZIPARCHIVE::CHECKCONS) !== true) {
             throw new Exception('Error opening zip file ' . $file);
         }
         $zip->extractTo(dirname($file));
         $zip->close();
         $this->logLine(sprintf('Unzipping %s', $file), nbLogger::COMMENT);
     }
     $files = $finder->add('*.zip')->in(nbConfig::get('project_dependencies'));
     foreach ($files as $file) {
         nbFileSystem::delete($file);
     }
 }
Пример #3
0
 protected function execute(array $arguments = array(), array $options = array())
 {
     $project = $arguments['project'];
     if (!$options['source']) {
         throw new Exception('Undefined source');
     }
     if (!$options['destination']) {
         throw new Exception('Undefined destination');
     }
     if (!$options['username']) {
         throw new Exception('Undefined username');
     }
     $destName = isset($options['new-name']) ? $options['new-name'] : $project;
     $source = $options['source'] . '/' . $project;
     $destination = $options['username'] . '@' . $options['destination'] . ':' . $destName;
     $authorsFile = isset($options['authors-file']) ? $options['authors-file'] : false;
     $tempDir = isset($options['temp-dir']) ? $options['temp-dir'] : '~/temp';
     $this->logLine('Converting ' . $project, nbLogger::COMMENT);
     $this->logLine('Source: ' . $source, nbLogger::COMMENT);
     $this->logLine('Destination: ' . $destination, nbLogger::COMMENT);
     if ($authorsFile) {
         $this->logLine('Authors: ' . $destination, nbLogger::COMMENT);
     }
     $trunk = isset($options['trunk']) ? $options['trunk'] : false;
     $tags = isset($options['tags']) ? $options['tags'] : false;
     $branches = isset($options['branches']) ? $options['branches'] : false;
     $useStandardLayout = !$trunk && !$tags && !$branches && !isset($options['no-standard-layout']);
     $this->logLine('Standard layout: ' . ($useStandardLayout ? 'true' : 'false'), nbLogger::COMMENT);
     $this->logLine('Removing temporary directory: ' . $tempDir, nbLogger::INFO);
     nbFileSystem::rmdir($tempDir, true);
     $command = sprintf('git svn clone %s %s', $source, $tempDir);
     $params = array(' --no-metadata');
     if ($authorsFile) {
         $params[] = '-A' . $authorsFile;
     }
     if ($trunk) {
         $params[] = '-T' . $trunk;
     }
     if ($tags) {
         $params[] = '-t' . $tags;
     }
     if ($branches) {
         $params[] = '-b' . $branches;
     }
     if ($useStandardLayout) {
         $params[] = '--stdlayout';
     }
     $dryRun = isset($options['dry-run']);
     $this->logLine('Cloning repository', nbLogger::INFO);
     $this->executeShellCommand($command . implode(' ', $params), $dryRun);
     $this->logLine('Applying git fix', nbLogger::INFO);
     $this->executeShellCommand('cd ' . $tempDir . ' && git svn-abandon-fix-refs', $dryRun);
     $this->executeShellCommand('cd ' . $tempDir . ' && git svn-abandon-cleanup', $dryRun);
     $this->executeShellCommand('cd ' . $tempDir . ' && git config --remove-section svn', $dryRun);
     $this->executeShellCommand('cd ' . $tempDir . ' && git config --remove-section svn-remote.svn', $dryRun);
     $this->logLine('Removing svn references', nbLogger::INFO);
     if (!isset($options['dry-run'])) {
         nbFileSystem::rmdir($tempDir . '/.git/svn', true);
         nbFileSystem::rmdir($tempDir . '/.git/refs/remotes/svn', true);
         nbFileSystem::rmdir($tempDir . '/.git/logs/refs/remotes/svn', true);
     }
     $this->logLine('Pushing to ' . $destination, nbLogger::INFO);
     $this->executeShellCommand('cd ' . $tempDir . sprintf(' && git remote add origin %s.git', $destination), $dryRun);
     $this->executeShellCommand('cd ' . $tempDir . ' && git push --all', $dryRun);
     $this->executeShellCommand('cd ' . $tempDir . ' && git push --tags', $dryRun);
 }