From 1b210b0691e3a0c8055f854239d727e2f621cde5 Mon Sep 17 00:00:00 2001 From: Aaron J Date: Tue, 12 Jul 2022 11:07:44 -0500 Subject: [PATCH] Adds Sublime Text recipe. --- bin/console | 2 +- composer.json | 2 +- dist/jez.phar | Bin 1689708 -> 1698261 bytes .../Download/AbstractInstallConsole.php | 5 + src/Object/Recipe/GenericRecipe.php | 7 +- src/Object/Recipe/SublimeText.php | 89 ++++++++++++++++++ 6 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 src/Object/Recipe/SublimeText.php diff --git a/bin/console b/bin/console index f3bd538..13fcbae 100755 --- a/bin/console +++ b/bin/console @@ -31,6 +31,6 @@ $command[] = new DevCoding\Jss\Easy\Command\Preferences\CC\BackupCommand(); $command[] = new DevCoding\Jss\Easy\Command\Preferences\CC\TransferCommand(); // Other Commands $command[] = new DevCoding\Jss\Easy\Command\PrepCommand(); -$app = new Application('Jez', 'v4.0.9'); +$app = new Application('Jez', 'v4.0.10'); $app->addCommands($command); $app->run(); diff --git a/composer.json b/composer.json index 5ef8a73..8acf5cf 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ }, "prefer-stable": true, "minimum-stability": "dev", - "version": "4.0.9", + "version": "4.0.10", "require": { "php": ">=7.1", "ext-json": "*", diff --git a/dist/jez.phar b/dist/jez.phar index b1329c74aacd54877b6be9aec425c7c131114967..a1eb8f26fc5fdd5bb7a3db3185982bb04d097c3b 100755 GIT binary patch delta 9552 zcmbtZ34Bvkx=-$Hnlwqn&|b3SE*WY10L|KugQg9odR)mKz#Kn>0xQaRKxx z$|i7?qa(7+sH39Ljw6{F0jZ<1Lm8Jr2L#4(WDul`%2V9lx#tUos&9Vp_j}0o%Q@#e z-}nF4bMEExh6V4vvtYwknc3of`HT_%H#=R@aB%5zY+6Zlqnnvihs1`ZT7$p-3_C#9$$(>4% z=M>T`vREuN5V}wb9(z_=q^OX9WS-tFe7cJJOlnkoxE&^W`ln~Ve}>DI6_TAcnN{)0 z8?ea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gwi?X8i!J^SVfZB_@jLn>HVAipNt`Es604jB zgJg6_CcR!S>P4r?YO$K_Hj696B1%TH=&=7GQjPQf!5RNwxxx62Bdk9TJ}(E=BwEZ? zt5d8uy7Vry!ReAR%r1$9TCz({lip<{CKJiOo9gF&_dI9hJeB0FPtzM9Sy6={xaZ^F zlI3*POGb;yB^pGd-l8|zO;#&0*KD;LELOe2Wpq01^>#BUP=iHp)azyD%%#s?;@r<)^1jyUzIB89#tR?p z@=3#WmpL`AJM9yI>%4q<_sMZS&55tX`b=>@J>Ta!0hi}^^GokxA9DGUOa5EozK8wl z@`MrO-%y=M{?C{Hti|b7ei3-ldA}0@e|ogE`hp+1{K*yIuD%fXW)D7jC|IGG<7|6s zhQm1rul`h};XNn(H-`|3i&q3Gak5UOd|`Re3(JFdFIToK!ejRZ`^Jqcs+cfxTv4Ge zCnraj(B3d(PU^6x+4W9cQj)HDZeyb^7B>f|qH&&os0Me%3NcIj6au+I+0-B2!3&iDh2z@5XkS5Hl;VdxRJ=z zK34LtY*LMNZ@m%{?uAeLh4D+5Y*o3JYz@6~8Naed9gAC5sQq!>T;E{#`eo{0G;n_V z4YdOA+MtfZ2bBRn`0EX7Gw#@^_Q6pb)sp;IAwGRLz!&#!RHvf4$KIIRq;3S(g`3o+ zxTRk0jZbe<+i>~4z-V0Fz(=6&$12=?HXzL1wpne<#tF*60l4d>An&Eht7^CMYS^PC z-f}qHfeqmgI&pu6uOGIlBLwVoGklW!`pxjn3HVr8#3getAppVersion($this->getDestination()); $comp = ($app_or_ver instanceof MacApplication) ? $this->getAppVersion($app_or_ver) : $app_or_ver; + if (0 == strpos($new->getRaw(), 'Build _')) + { + $new = new SemanticVersion('0.0+'.$new->getBuild()); + } + return $new instanceof SemanticVersion && $comp instanceof SemanticVersion && $new->eq($comp); } diff --git a/src/Object/Recipe/GenericRecipe.php b/src/Object/Recipe/GenericRecipe.php index 328f862..0a6979e 100644 --- a/src/Object/Recipe/GenericRecipe.php +++ b/src/Object/Recipe/GenericRecipe.php @@ -96,9 +96,14 @@ public function isMatch(MacApplication $offered) } else { - $cVer = new SemanticVersion($this->getCurrentVersion()); + $cVer = new SemanticVersion($ver); $oVer = $offered->getShortVersion() ?? $offered->getVersion(); + if (0 == strpos($oVer->getRaw(), 'Build _')) + { + $oVer = new SemanticVersion('0.0+'.$oVer->getBuild()); + } + if ($oVer->eq($cVer)) { return true; diff --git a/src/Object/Recipe/SublimeText.php b/src/Object/Recipe/SublimeText.php new file mode 100644 index 0000000..b3ac64c --- /dev/null +++ b/src/Object/Recipe/SublimeText.php @@ -0,0 +1,89 @@ + + * @license https://github.com/deviscoding/jss-helper/blob/main/LICENSE + */ +class SublimeText extends AbstractRecipe +{ + protected $version; + + public function getName() + { + return 'Sublime Text'; + } + + public function getPath() + { + return '/Applications/Sublime Text.app'; + } + + public function getDownloadUrl() + { + $build = str_replace('0.0+', '', $this->getCurrentVersion()); + + return sprintf('https://download.sublimetext.com/sublime_text_build_%s_mac.zip', $build); + } + + public function getDestinationUrl() + { + return $this->getDownloadUrl(); + } + + public function getInstallerType() + { + return $this->getInstallerTypeFromUrl($this->getDownloadUrl()); + } + + public function getCurrentVersion() + { + if (!isset($this->version)) + { + if ($notes = $this->getReleaseNotes()) + { + $crawler = new Crawler($notes); + $crawler = $crawler->filter('#changelog'); + if ($crawler->count() > 0) + { + $crawler = $crawler->filter('article')->reduce(function (Crawler $node, $i) { + $href = $node->attr('class'); + + return false !== stripos($href, 'current'); + }); + + if ($h3 = $crawler->filter('h3')) + { + $this->version = '0.0+'.str_replace('Build ', '', $h3->html()); + } + } + } + } + + return $this->version; + } + + /** + * Grabs the HTML of the updates page. + * + * @return string|null + */ + protected function getReleaseNotes() + { + $url = 'https://www.sublimetext.com/download'; + $ua = $this->getUserAgent(); + + if ($resp = (new DownloadHelper())->getUrl($url, null, null, $ua)) + { + return $resp['body'] ?? null; + } + + return null; + } +}