@@ -10,7 +10,8 @@ class RoboFile extends \Robo\Tasks
1010 use DocumentationHelpers;
1111
1212 const REPO_BLOB_URL = 'https://github.com/Codeception/Codeception/blob ' ;
13- const STABLE_BRANCH = '4.2 ' ;
13+ const BRANCH_4x = '4.2 ' ;
14+ const BRANCH_5x = '5.0 ' ;
1415
1516 function post ()
1617 {
@@ -180,12 +181,11 @@ public function buildDocsUtils()
180181 $ utils = [
181182 'Autoload ' => null ,
182183 'Fixtures ' => null ,
183- 'Locator ' => null ,
184- 'XmlBuilder ' => null ,
184+ 'Locator ' => ' lib-web ' ,
185+ 'XmlBuilder ' => ' lib-xml ' ,
185186 'JsonType ' => 'module-rest ' ,
186187 'HttpCode ' => 'lib-innerbrowser ' ,
187188 ];
188- //JsonType is in module-rest, HttpCode - in lib-innerbrowser
189189
190190 foreach ($ utils as $ utilName => $ repositoryName ) {
191191 $ className = '\Codeception\Util \\' . $ utilName ;
@@ -322,7 +322,7 @@ public function buildDocsExtensions()
322322 ->prepend ("# Official Extensions \n" )
323323 ->processClassSignature (function (ReflectionClass $ r , $ text ) {
324324 $ name = $ r ->getShortName ();
325- return "## $ name \n\n[See Source]( " . self ::REPO_BLOB_URL . "/ " . self ::STABLE_BRANCH . "/ext/ $ name.php) " ;
325+ return "## $ name \n\n[See Source]( " . self ::REPO_BLOB_URL . "/ " . self ::BRANCH_5x . "/ext/ $ name.php) " ;
326326 })
327327 ->filterMethods (function (ReflectionMethod $ r ) {
328328 return false ;
@@ -336,7 +336,7 @@ public function buildDocsExtensions()
336336 protected function documentApiClass ($ file , $ className , $ all = false , $ repositoryName = null )
337337 {
338338 if ($ repositoryName === null ) {
339- $ repositoryUrl = self ::REPO_BLOB_URL . "/ " . self ::STABLE_BRANCH ;
339+ $ repositoryUrl = self ::REPO_BLOB_URL . "/ " . self ::BRANCH_5x ;
340340 } else {
341341 $ repositoryUrl = 'https://github.com/Codeception/ ' . $ repositoryName . '/blob/master ' ;
342342 }
@@ -471,14 +471,38 @@ private function postProcessFile($pageName, $documentationFile)
471471 file_put_contents ($ documentationFile , $ contents );
472472 }
473473
474+ public function buildPhar80 ()
475+ {
476+ $ version = self ::BRANCH_5x . '. ' . date ('Ymd ' );
477+ $ releaseDir = "releases/ $ version " ;
478+ $ this ->stopOnFail ();
479+
480+ $ this ->taskFilesystemStack ()->mkdir ('build/80 ' )->run ();
481+ $ this ->setCodeceptionVersionTo ('^5.0 ' );
482+ $ this ->setPlatformVersionTo ('8.0.2 ' );
483+ $ buildFile = 'build/80/codecept.phar ' ;
484+ $ this ->buildPhar ($ buildFile );
485+ $ this ->updateVersionFile ($ buildFile , 'php80/codecept.version ' );
486+ $ versionedFile = "$ releaseDir/codecept.phar " ;
487+ $ this ->taskFilesystemStack ()
488+ ->stopOnFail ()
489+ ->mkdir ($ releaseDir )
490+ ->copy ($ buildFile , $ versionedFile )
491+ ->remove ('php80/codecept.phar ' )
492+ ->symlink ($ versionedFile , 'php80/codecept.phar ' )
493+ ->run ();
494+ }
495+
474496 public function buildPhar72 ()
475497 {
476- $ version = self ::STABLE_BRANCH . '. ' . date ('Ymd ' );
498+ $ version = self ::BRANCH_4x . '. ' . date ('Ymd ' );
477499 $ releaseDir = "releases/ $ version " ;
478500 $ this ->stopOnFail ();
479501
480502 $ this ->taskFilesystemStack ()->mkdir ('build/72 ' )->run ();
503+ $ this ->setCodeceptionVersionTo ('^4.1 ' );
481504 $ this ->setPlatformVersionTo ('7.2.0 ' );
505+ $ this ->requireHoaConsole ();
482506 $ buildFile = 'build/72/codecept.phar ' ;
483507 $ this ->buildPhar ($ buildFile );
484508 $ this ->updateVersionFile ($ buildFile , 'codecept.version ' );
@@ -494,12 +518,14 @@ public function buildPhar72()
494518
495519 public function buildPhar56 ()
496520 {
497- $ version = self ::STABLE_BRANCH . '. ' . date ('Ymd ' );
521+ $ version = self ::BRANCH_4x . '. ' . date ('Ymd ' );
498522 $ releaseDir = "releases/ $ version " ;
499523 $ this ->stopOnFail ();
500524
501525 $ this ->taskFilesystemStack ()->mkdir ('build/56 ' )->run ();
526+ $ this ->setCodeceptionVersionTo ('^4.1 ' );
502527 $ this ->setPlatformVersionTo ('5.6.4 ' );
528+ $ this ->requireHoaConsole ();
503529 //filenames must be different, because Phar refuses to build second file with the same name
504530 $ buildFile = 'build/56/codecept.phar ' ;
505531 $ this ->buildPhar ($ buildFile );
@@ -512,17 +538,19 @@ public function buildPhar56()
512538 ->remove ('php56/codecept.phar ' )
513539 ->symlink ("../ $ versionedFile " , 'php56/codecept.phar ' )
514540 ->run ();
515-
516541 }
517542
518- public function findReleases ()
543+ private function requireHoaConsole (): void
519544 {
520-
545+ $ this ->taskComposerRequire ()
546+ ->dependency ('hoa/console ' )
547+ ->workingDir ('package ' )
548+ ->run ();
521549 }
522550
523551 public function release ()
524552 {
525- $ version = self ::STABLE_BRANCH . '. ' . date ('Ymd ' );
553+ $ version = self ::BRANCH_4x . '. ' . date ('Ymd ' );
526554 $ releaseDir = "releases/ $ version " ;
527555 $ this ->updateBuildsPage ();
528556
@@ -538,12 +566,37 @@ public function release()
538566 ->run ();
539567 }
540568
569+ public function release80 ()
570+ {
571+ $ version = self ::BRANCH_5x . '. ' . date ('Ymd ' );
572+ $ releaseDir = "releases/ $ version " ;
573+ $ this ->updateBuildsPage ();
574+
575+ $ this ->taskGitStack ()
576+ ->stopOnFail ()
577+ ->checkout ('-- package/composer.json ' )
578+ ->add ('builds.markdown ' )
579+ ->add ('php80/codecept.phar ' )
580+ ->add ('php80/codecept.version ' )
581+ ->add ($ releaseDir )
582+ ->run ();
583+ }
584+
541585 private function setPlatformVersionTo ($ version )
542586 {
543587 $ this ->taskComposerConfig ()->workingDir ('package ' )->set ('platform.php ' , $ version )->run ();
544588 $ this ->taskComposerUpdate ()->preferDist ()->optimizeAutoloader ()->workingDir ('package ' )->run ();
545589 }
546590
591+ private function setCodeceptionVersionTo ($ version )
592+ {
593+ $ this ->taskComposerRequire ()
594+ ->dependency ('codeception/codeception ' , $ version )
595+ ->ignorePlatformRequirements ()
596+ ->workingDir ('package ' )
597+ ->run ();
598+ }
599+
547600 /**
548601 * @desc creates codecept.phar
549602 * @throws Exception
@@ -691,7 +744,7 @@ public function updateBuildsPage()
691744
692745 foreach ($ releases as $ release ) {
693746 $ releaseName = $ release ->getBasename ();
694- $ downloadUrl = "http ://codeception.com/releases/$ releaseName/codecept.phar " ;
747+ $ downloadUrl = "https ://codeception.com/releases/$ releaseName/codecept.phar " ;
695748
696749 list ($ major , $ minor ) = explode ('. ' , $ releaseName );
697750 if ("$ major. $ minor " != $ branch ) {
@@ -701,14 +754,16 @@ public function updateBuildsPage()
701754 $ releaseFile ->line ("*Requires: PHP 5.3 and higher + CURL* \n" );
702755 } elseif ($ major == 2 && $ minor < 4 ) {
703756 $ releaseFile ->line ("*Requires: PHP 5.4 and higher + CURL* \n" );
704- } else {
757+ } elseif ( $ major < 5 ) {
705758 $ releaseFile ->line ("*Requires: PHP 5.6 and higher + CURL* \n" );
759+ } else {
760+ $ releaseFile ->line ("*Requires: PHP 8.0 and higher + CURL* \n" );
706761 }
707762 $ releaseFile ->line ("* **[Download Latest $ branch Release]( $ downloadUrl)** " );
708763 }
709764
710765 if (file_exists ("releases/ $ releaseName/php54/codecept.phar " )) {
711- $ downloadUrl2 = "http ://codeception.com/releases/$ releaseName/php54/codecept.phar " ;
766+ $ downloadUrl2 = "https ://codeception.com/releases/$ releaseName/php54/codecept.phar " ;
712767 if (version_compare ($ releaseName , '2.4.0 ' , '>= ' )) {
713768 $ versionLine = "* [ $ releaseName for PHP 7]( $ downloadUrl) " ;
714769 $ versionLine .= ", [for PHP 5.6]( $ downloadUrl2) " ;
@@ -721,7 +776,7 @@ public function updateBuildsPage()
721776 }
722777 } elseif (file_exists ("releases/ $ releaseName/php56/codecept.phar " )) {
723778 $ versionLine = "* [ $ releaseName for PHP 7.2+]( $ downloadUrl) " ;
724- $ downloadUrl2 = "http ://codeception.com/releases/$ releaseName/php56/codecept.phar " ;
779+ $ downloadUrl2 = "https ://codeception.com/releases/$ releaseName/php56/codecept.phar " ;
725780 $ versionLine .= ", [for PHP 5.6 - 7.1]( $ downloadUrl2) " ;
726781 } else {
727782 $ versionLine = "* [ $ releaseName]( $ downloadUrl) " ;
0 commit comments