コード例 #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $pr = $this->getAdapter()->getPullRequest($input->getArgument('pr_number'));
     $sourceOrg = $pr['head']['user'];
     $branchName = $pr['head']['ref'];
     /** @var GitConfigHelper $gitConfigHelper */
     $gitConfigHelper = $this->getHelper('git_config');
     $gitConfigHelper->ensureRemoteExists($sourceOrg, $pr['head']['repo']);
     /** @var GitHelper $gitHelper */
     $gitHelper = $this->getHelper('git');
     $gitHelper->remoteUpdate($sourceOrg);
     $lastTag = $gitHelper->getLastTagOnBranch($sourceOrg . '/' . $branchName);
     if (empty($lastTag)) {
         $lastTag = '0.0.0';
     }
     // adjust case for format v2.3
     $lastTag = ltrim($lastTag, 'v');
     $builder = Parser::toBuilder($lastTag);
     switch (true) {
         case $input->getOption('major'):
             $builder->incrementMajor();
             break;
         case $input->getOption('minor'):
             $builder->incrementMinor();
             break;
         case $input->getOption('patch'):
             $builder->incrementPatch();
             break;
         default:
             $builder->incrementPatch();
             break;
     }
     $output->writeln(Dumper::toString($builder->getVersion()));
     return self::COMMAND_SUCCESS;
 }
コード例 #2
0
ファイル: TagTask.php プロジェクト: pierredup/gush-block
 /**
  * {@inheritDoc}
  */
 public function run(OutputInterface $output)
 {
     $baseBranch = $this->getParameter('base_branch');
     $release = $this->getParameter('release');
     $this->runGit($output, ['git', 'checkout', $baseBranch]);
     $lastTag = $this->runCommand(['git', 'describe', '--tags', '--abbrev=0', 'HEAD']);
     $builder = Parser::toBuilder($lastTag);
     switch (true) {
         case 'major' === $release:
             $builder->incrementMajor();
             break;
         case 'minor' === $release:
             $builder->incrementMinor();
             break;
         case 'patch' === $release:
             $builder->incrementPatch();
             break;
         default:
             $builder->incrementPatch();
             break;
     }
     $newNumber = Dumper::toString($builder->getVersion());
     $this->runGit($output, ['git', 'tag', '-a', $newNumber, '-m', 'auto tagged']);
     $this->runGit($output, ['git', 'push', '--tags']);
 }
コード例 #3
0
ファイル: IncrementCommand.php プロジェクト: mvriel/versioner
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $filename = $input->getArgument('filename');
     $versionNumber = file_get_contents($filename);
     $version = Builder::create()->importString($versionNumber);
     $part = $input->getOption('part');
     switch (strtolower($part)) {
         case self::PART_MAJOR:
             $version->incrementMajor();
             $version->clearPreRelease();
             $version->clearBuild();
             break;
         case self::PART_PATCH:
             $version->incrementPatch();
             $version->clearPreRelease();
             $version->clearBuild();
             break;
         case self::PART_MINOR:
             $version->incrementMinor();
             $version->clearPreRelease();
             $version->clearBuild();
             break;
         default:
             throw new \InvalidArgumentException('Invalid name for the version part was provided, received: ' . $part);
             break;
     }
     $preRelease = $input->getOption('pre-release');
     if ($preRelease) {
         $version->setPreRelease(array($preRelease));
     }
     $newVersionNumber = Dumper::toString($version);
     file_put_contents($filename, $newVersionNumber);
     $output->writeln("<info>The version number was incremented from <comment>{$versionNumber}</comment> to " . "<comment>{$newVersionNumber}</comment></info>");
 }
コード例 #4
0
 public function testIncrementVersion()
 {
     $newVersion = (new Builder())->importString('1.2.4');
     $this->assertNotSame($this->versioner->getCurrentVersion(), Dumper::toString($newVersion));
     $this->commitAChange();
     $this->assertSame(Dumper::toString($newVersion), $this->versioner->incrementVersion('Patch'));
 }
コード例 #5
0
 // Retrieve manifest
 echo " - Downloading manifest...{$n}";
 $manifest = file_get_contents('http://box-project.github.io/box2/manifest.json');
 echo " - Reading manifest...{$n}";
 $manifest = json_decode($manifest);
 $current = null;
 foreach ($manifest as $item) {
     $item->version = Parser::toVersion($item->version);
     if ($current && Comparator::isGreaterThan($item->version, $current->version)) {
         $current = $item;
     }
 }
 if (!$item) {
     echo " x No application download was found.{$n}";
 }
 echo " - Downloading Box v", Dumper::toString($item->version), "...{$n}";
 file_put_contents($item->name, file_get_contents($item->url));
 echo " - Checking file checksum...{$n}";
 if ($item->sha1 !== sha1_file($item->name)) {
     unlink($item->name);
     echo " x The download was corrupted.{$n}";
 }
 echo " - Checking if valid Phar...{$n}";
 try {
     new Phar($item->name);
 } catch (Exception $e) {
     echo " x The Phar is not valid.\n\n";
     throw $e;
 }
 echo " - Making Box executable...{$n}";
 @chmod($item->name, 0755);
コード例 #6
0
 public function testToString()
 {
     $this->assertEquals('1.2.3-pre.1+build.1', Dumper::toString($this->version));
 }
コード例 #7
0
ファイル: PrepOfflinePages.php プロジェクト: bcremer/mwop.net
 /**
  * Increment the patch version
  *
  * @param string $version
  * @return string
  */
 private function incrementVersion($version)
 {
     $builder = Version\Parser::toBuilder($version);
     $builder->incrementPatch();
     return Version\Dumper::toString($builder->getVersion());
 }
コード例 #8
0
 private function setVersion(Version $version)
 {
     return (new Builder())->importString($this->vcs->setVersion(Dumper::toString($version)));
 }
コード例 #9
0
 /**
  *
  */
 public function testAddedPublicMethodInInterface()
 {
     $this->assertEquals('2.0.0', Dumper::toString($this->core->runInspection($this->basePath . 'Interfaces' . DIRECTORY_SEPARATOR . 'AddedPublicMethod.php')));
 }
コード例 #10
0
 /**
  * @param Version $version
  * @param $file
  * @param $param
  * @throws \RuntimeException
  */
 protected function updateParametersFile(Version $version, $file, $param)
 {
     $yamlParser = new Parser();
     $params = $yamlParser->parse(file_get_contents($file));
     if (!empty($params['parameters'])) {
         $params['parameters'][$param] = Dumper::toString($version);
         file_put_contents($file, Yaml::dump($params));
     } else {
         throw new \RuntimeException('Not valid parameters file?');
     }
 }