How to use tagMinorVersion method of pusher class

Best Atoum code snippet using pusher.tagMinorVersion

pusher.php

Source:pusher.php Github

copy

Full Screen

...22 protected $taggerEngine = null;23 protected $git = null;24 protected $forceMode = false;25 protected $tagMajorVersion = false;26 protected $tagMinorVersion = false;27 public function __construct($name, atoum\adapter $adapter = null)28 {29 parent::__construct($name, $adapter);30 $this31 ->setRemote()32 ->setTagFile()33 ->setTaggerEngine()34 ->setWorkingDirectory()35 ->setGit()36 ;37 }38 public function setRemote($remote = null)39 {40 $this->remote = $remote ?: self::defaultRemote;41 return $this;42 }43 public function getRemote()44 {45 return $this->remote;46 }47 public function setTagFile($tagFile = null)48 {49 if ($tagFile !== null)50 {51 $tagFile = (string) $tagFile;52 }53 else54 {55 $tagFile = $this->getDirectory() . self::defaultTagFile;56 }57 $this->tagFile = $tagFile;58 return $this;59 }60 public function getTagFile()61 {62 return $this->tagFile;63 }64 public function setTaggerEngine(scripts\tagger\engine $engine = null)65 {66 $this->taggerEngine = $engine ?: new scripts\tagger\engine();67 return $this;68 }69 public function getTaggerEngine()70 {71 return $this->taggerEngine;72 }73 public function setWorkingDirectory($workingDirectory = null)74 {75 $this->workingDirectory = $workingDirectory ?: $this->adapter->getcwd();76 return $this;77 }78 public function getWorkingDirectory()79 {80 return $this->workingDirectory;81 }82 public function setGit(commands\git $git = null)83 {84 $this->git = $git ?: new commands\git();85 return $this;86 }87 public function getGit()88 {89 return $this->git;90 }91 public function setForceMode($force=true)92 {93 $this->forceMode = $force;94 return $this;95 }96 public function getForceMode()97 {98 return $this->forceMode;99 }100 public function tagMajorVersion()101 {102 $this->tagMajorVersion = true;103 $this->tagMinorVersion = false;104 }105 public function tagMinorVersion()106 {107 $this->tagMajorVersion = false;108 $this->tagMinorVersion = true;109 }110 public function tagPatchVersion()111 {112 $this->tagMajorVersion = false;113 $this->tagMinorVersion = false;114 }115 protected function setArgumentHandlers()116 {117 parent::setArgumentHandlers()118 ->addArgumentHandler(119 function($script, $argument, $value) {120 $this->setForceMode(true);121 },122 array('-f', '--force'),123 $this->locale->_('Force execution by avoiding any confirmation')124 )125 ->addArgumentHandler(126 function($script, $argument, $remote) {127 if (sizeof($remote) != 1)128 {129 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $remote, $script->getName()));130 }131 $script->setRemote(reset($remote));132 },133 array('-tr', '--to-remote'),134 '<string>',135 $this->locale->_('<string> will be used as remote')136 )137 ->addArgumentHandler(138 function($script, $argument, $tagFile) {139 if (sizeof($tagFile) != 1)140 {141 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));142 }143 $script->setTagFile(reset($tagFile));144 },145 array('-tf', '--tag-file'),146 '<path>',147 $this->locale->_('File <path> will be used to store last tag')148 )149 ->addArgumentHandler(150 function($script, $argument, $value) {151 $script->tagMajorVersion();152 },153 array('-MR', '--major-release'),154 null,155 $this->locale->_('Tag a new major version')156 )157 ->addArgumentHandler(158 function($script, $argument, $value) {159 $script->tagMinorVersion();160 },161 array('-mr', '--minor-release'),162 null,163 $this->locale->_('Tag a new minor version')164 )165 ->addArgumentHandler(166 function($script, $argument, $value) {167 $script->tagPatchVersion();168 },169 array('-pr', '--patch-release'),170 null,171 $this->locale->_('Tag a new patch version')172 )173 ;174 return $this;175 }176 protected function doRun()177 {178 try179 {180 $tag = @file_get_contents($this->tagFile);181 if ($tag === false)182 {183 throw new exceptions\runtime('Unable to read \'' . $this->tagFile . '\'');184 }185 $tag = $this->getNextVersion(trim($tag));186 if ($this->getForceMode() === false && $this->prompt(sprintf($this->locale->_("You are about to push the '%s' version. Type 'Y' to confirm."), $tag)) !== 'Y')187 {188 return $this;189 }190 if (@file_put_contents($this->tagFile, $tag) === false)191 {192 throw new exceptions\runtime('Unable to write in \'' . $this->tagFile . '\'');193 }194 $this->taggerEngine->setSrcDirectory($this->workingDirectory);195 if ($this->tagStableVersion($tag) === true)196 {197 if ($this->createGitTag($tag) === true)198 {199 if ($this->tagDevelopmentVersion(self::defaultMasterTag) === true)200 {201 if ($this->pushToRemote($tag) === true)202 {203 if ($this->pushTagToRemote($tag) === true)204 {205 $this->writeInfo('Tag \'' . $tag . '\' successfully sent to remote \'' . $this->remote . '\'');206 }207 }208 }209 }210 }211 }212 catch (\exception $exception)213 {214 $this->writeError($exception->getMessage());215 }216 return $this;217 }218 protected function getNextVersion($tag)219 {220 $versionPattern = '/^(\d+)\.(\d+)\.(\d+)$/';221 $increment = function($position) {222 return function($matches) use ($position) {223 for ($i = 1; $i <= 3; $i++)224 {225 if ($i > $position)226 {227 $matches[$i] = 0;228 }229 if ($i === $position)230 {231 $matches[$i] += 1;232 }233 }234 return implode('.', array_slice($matches, 1));235 };236 };237 if ($this->tagMajorVersion === true)238 {239 return preg_replace_callback($versionPattern, $increment(self::majorVersion), $tag);240 }241 if ($this->tagMinorVersion === true)242 {243 return preg_replace_callback($versionPattern, $increment(self::minorVersion), $tag);244 }245 return preg_replace_callback($versionPattern, $increment(self::patchVersion), $tag);246 }247 private function tagSrcWith($tag)248 {249 $this->taggerEngine250 ->setVersion(sprintf(static::versionPattern, $tag))251 ->tagVersion()252 ;253 return $this;254 }255 private function tagStableVersion($tag)...

Full Screen

Full Screen

tagMinorVersion

Using AI Code Generation

copy

Full Screen

1require_once('pusher.php');2$pusher = new pusher();3$pusher->tagMinorVersion();4require_once('pusher.php');5$pusher = new pusher();6$pusher->tagMinorVersion('1.0.2');7require_once('pusher.php');8$pusher = new pusher();9$pusher->tagMajorVersion();10require_once('pusher.php');11$pusher = new pusher();12$pusher->tagMajorVersion('1.0.2');

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger tagMinorVersion code on LambdaTest Cloud Grid

Execute automation tests with tagMinorVersion on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful