Example #1
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $git = $this->getDriver($input->getArgument('url'));
     $branch = $input->getOption('branch');
     $path = $input->getArgument('path');
     if ($input->getOption('switch-branch')) {
         $git->checkoutBranch($branch, $path, $output);
         return;
     }
     $version = new Version();
     $latest = $this->getLatestVersion($input, $git);
     $next = $version->increase($latest, $input->getOption('version-type'));
     if ($input->getOption('evaluate')) {
         if ($git->hasChangesSinceTag($latest, $branch, $path, $output)) {
             $output->write($next);
         }
         return;
     }
     if ($git->hasChangesSinceTag($latest, $branch, $path, $output)) {
         $this->handleChanges($input, $output, $git, $path, $latest, $next, $branch);
     } else {
         if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
             $output->writeln(sprintf('<info>Skip creating tag "%s" because there are no changes since tag "%s"</info>', $next, $latest));
         }
     }
 }
Example #2
0
 /**
  * @test
  */
 public function shouldIncreaseNullVersion()
 {
     $version = new Version();
     $this->assertEquals('0.0.1', $version->increase('0.0.0'));
 }