How to use tagMajorVersion method of pusher class

Best Atoum code snippet using pusher.tagMajorVersion

pusher.php

Source:pusher.php Github

copy

Full Screen

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

Full Screen

Full Screen

tagMajorVersion

Using AI Code Generation

copy

Full Screen

1require_once 'pusher.php';2$pusher = new Pusher('your app key', 'your app secret', 'your app id');3echo $pusher->tagMajorVersion('tag1', 'tag2');4require_once 'pusher.php';5$pusher = new Pusher('your app key', 'your app secret', 'your app id');6echo $pusher->tagMinorVersion('tag1', 'tag2');7require_once 'pusher.php';8$pusher = new Pusher('your app key', 'your app secret', 'your app id');9echo $pusher->tagPatchVersion('tag1', 'tag2');10require_once 'pusher.php';11$pusher = new Pusher('your app key', 'your app secret', 'your app id');12echo $pusher->tagVersion('tag1', 'tag2');13require_once 'pusher.php';14$pusher = new Pusher('your app key', 'your app secret', 'your app id');15echo $pusher->untagVersion('tag1', 'tag2');16require_once 'pusher.php';17$pusher = new Pusher('your app key', 'your app secret', 'your app id');18echo $pusher->untagAll('tag1', 'tag2');19require_once 'pusher.php';20$pusher = new Pusher('your app key', 'your app secret', 'your app id');21print_r($pusher->getTaggedVersions('tag1', 'tag2'));22require_once 'pusher.php';23$pusher = new Pusher('your app key', 'your app secret', 'your app id');24print_r($pusher->getTaggedVersions('tag

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 tagMajorVersion code on LambdaTest Cloud Grid

Execute automation tests with tagMajorVersion 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