Updated extensions, spring remix
This commit is contained in:
parent
f64ca3f8fe
commit
bb251eed4a
Binary file not shown.
|
@ -2,7 +2,7 @@
|
|||
// Serve extension, https://github.com/annaesvensson/yellow-serve
|
||||
|
||||
class YellowServe {
|
||||
const VERSION = "0.8.23";
|
||||
const VERSION = "0.8.24";
|
||||
public $yellow; // access to API
|
||||
|
||||
// Handle initialisation
|
||||
|
@ -24,7 +24,7 @@ class YellowServe {
|
|||
return "serve [url]";
|
||||
}
|
||||
|
||||
// Process command to start built-in web server
|
||||
// Process command to start web server
|
||||
public function processCommandServe($command, $text) {
|
||||
list($url) = $this->yellow->toolbox->getTextArguments($text);
|
||||
if (is_string_empty($url)) $url = "http://localhost:8000/";
|
||||
|
@ -32,7 +32,7 @@ class YellowServe {
|
|||
if ($scheme=="http" && !is_string_empty($address) && is_string_empty($base)) {
|
||||
if (!preg_match("/\:\d+$/", $address)) $address .= ":8000";
|
||||
if ($this->checkServerSettings("$scheme://$address/")) {
|
||||
echo "Starting built-in web server. Open a web browser and go to $scheme://$address/\n";
|
||||
echo "Starting web server. Open a web browser and go to $scheme://$address/\n";
|
||||
echo "Press Ctrl+C to quit...\n";
|
||||
exec(PHP_BINARY." -S $address yellow.php 2>&1", $outputLines, $returnStatus);
|
||||
$statusCode = $returnStatus!=0 ? 500 : 200;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Static extension, https://github.com/annaesvensson/static-command
|
||||
|
||||
class YellowStatic {
|
||||
const VERSION = "0.8.49";
|
||||
const VERSION = "0.8.50";
|
||||
public $yellow; // access to API
|
||||
public $files; // number of files
|
||||
public $links; // number of links
|
||||
|
@ -45,32 +45,32 @@ class YellowStatic {
|
|||
// Handle command
|
||||
public function onCommand($command, $text) {
|
||||
switch ($command) {
|
||||
case "build": $statusCode = $this->processCommandBuild($command, $text); break;
|
||||
case "check": $statusCode = $this->processCommandCheck($command, $text); break;
|
||||
case "clean": $statusCode = $this->processCommandClean($command, $text); break;
|
||||
default: $statusCode = 0;
|
||||
case "generate": $statusCode = $this->processCommandGenerate($command, $text); break;
|
||||
case "check": $statusCode = $this->processCommandCheck($command, $text); break;
|
||||
case "clean": $statusCode = $this->processCommandClean($command, $text); break;
|
||||
default: $statusCode = 0;
|
||||
}
|
||||
return $statusCode;
|
||||
}
|
||||
|
||||
// Handle command help
|
||||
public function onCommandHelp() {
|
||||
return array("build [directory location]", "check [directory location]", "clean [directory location]");
|
||||
return array("generate [directory location]", "check [directory location]", "clean [directory location]");
|
||||
}
|
||||
|
||||
// Process command to build static website
|
||||
public function processCommandBuild($command, $text) {
|
||||
// Process command to generate static website
|
||||
public function processCommandGenerate($command, $text) {
|
||||
$statusCode = 0;
|
||||
list($path, $location) = $this->yellow->toolbox->getTextArguments($text);
|
||||
if (is_string_empty($location) || substru($location, 0, 1)=="/") {
|
||||
if ($this->checkStaticSettings()) {
|
||||
$statusCode = $this->buildStaticFiles($path, $location);
|
||||
$statusCode = $this->generateStaticFiles($path, $location);
|
||||
} else {
|
||||
$statusCode = 500;
|
||||
$this->files = 0;
|
||||
$this->errors = 1;
|
||||
$fileName = $this->yellow->system->get("coreExtensionDirectory").$this->yellow->system->get("coreSystemFile");
|
||||
echo "ERROR building files: Please configure StaticUrl in file '$fileName'!\n";
|
||||
echo "ERROR generating files: Please configure StaticUrl in file '$fileName'!\n";
|
||||
}
|
||||
echo "Yellow $command: $this->files file".($this->files!=1 ? "s" : "");
|
||||
echo ", $this->errors error".($this->errors!=1 ? "s" : "")."\n";
|
||||
|
@ -81,8 +81,8 @@ class YellowStatic {
|
|||
return $statusCode;
|
||||
}
|
||||
|
||||
// Build static files
|
||||
public function buildStaticFiles($path, $locationFilter) {
|
||||
// Generate static files
|
||||
public function generateStaticFiles($path, $locationFilter) {
|
||||
$path = rtrim(is_string_empty($path) ? $this->yellow->system->get("staticDirectory") : $path, "/");
|
||||
$this->files = $this->errors = 0;
|
||||
$this->locationsArguments = $this->locationsArgumentsPagination = array();
|
||||
|
@ -92,43 +92,43 @@ class YellowStatic {
|
|||
$locations = $this->getContentLocations();
|
||||
$filesEstimated = count($locations);
|
||||
foreach ($locations as $location) {
|
||||
echo "\rBuilding static website ".$this->getProgressPercent($this->files, $filesEstimated, 5, 60)."%... ";
|
||||
echo "\rGenerating static website ".$this->getProgressPercent($this->files, $filesEstimated, 5, 60)."%... ";
|
||||
if (!preg_match("#^$base$locationFilter#", "$base$location")) continue;
|
||||
$statusCode = max($statusCode, $this->buildStaticFile($path, $location, true));
|
||||
$statusCode = max($statusCode, $this->generateStaticFile($path, $location, true));
|
||||
}
|
||||
foreach ($this->locationsArguments as $location) {
|
||||
echo "\rBuilding static website ".$this->getProgressPercent($this->files, $filesEstimated, 5, 60)."%... ";
|
||||
echo "\rGenerating static website ".$this->getProgressPercent($this->files, $filesEstimated, 5, 60)."%... ";
|
||||
if (!preg_match("#^$base$locationFilter#", "$base$location")) continue;
|
||||
$statusCode = max($statusCode, $this->buildStaticFile($path, $location, true));
|
||||
$statusCode = max($statusCode, $this->generateStaticFile($path, $location, true));
|
||||
}
|
||||
$filesEstimated = $this->files + count($this->locationsArguments) + count($this->locationsArgumentsPagination);
|
||||
foreach ($this->locationsArgumentsPagination as $location) {
|
||||
echo "\rBuilding static website ".$this->getProgressPercent($this->files, $filesEstimated, 5, 95)."%... ";
|
||||
echo "\rGenerating static website ".$this->getProgressPercent($this->files, $filesEstimated, 5, 95)."%... ";
|
||||
if (!preg_match("#^$base$locationFilter#", "$base$location")) continue;
|
||||
if (substru($location, -1)!=$this->yellow->toolbox->getLocationArgumentsSeparator()) {
|
||||
$statusCode = max($statusCode, $this->buildStaticFile($path, $location, false, true));
|
||||
$statusCode = max($statusCode, $this->generateStaticFile($path, $location, false, true));
|
||||
}
|
||||
for ($pageNumber=2; $pageNumber<=999; ++$pageNumber) {
|
||||
$statusCodeLocation = $this->buildStaticFile($path, $location.$pageNumber, false, true);
|
||||
$statusCodeLocation = $this->generateStaticFile($path, $location.$pageNumber, false, true);
|
||||
$statusCode = max($statusCode, $statusCodeLocation);
|
||||
if ($statusCodeLocation==100) break;
|
||||
}
|
||||
}
|
||||
if (is_string_empty($locationFilter)) {
|
||||
foreach ($this->getMediaLocations() as $location) {
|
||||
$statusCode = max($statusCode, $this->buildStaticFile($path, $location));
|
||||
$statusCode = max($statusCode, $this->generateStaticFile($path, $location));
|
||||
}
|
||||
foreach ($this->getExtraLocations($path) as $location) {
|
||||
$statusCode = max($statusCode, $this->buildStaticFile($path, $location));
|
||||
$statusCode = max($statusCode, $this->generateStaticFile($path, $location));
|
||||
}
|
||||
$statusCode = max($statusCode, $this->buildStaticFile($path, "/error/", false, false, true));
|
||||
$statusCode = max($statusCode, $this->generateStaticFile($path, "/error/", false, false, true));
|
||||
}
|
||||
echo "\rBuilding static website 100%... done\n";
|
||||
echo "\rGenerating static website 100%... done\n";
|
||||
return $statusCode;
|
||||
}
|
||||
|
||||
// Build static file
|
||||
public function buildStaticFile($path, $location, $analyse = false, $probe = false, $error = false) {
|
||||
// Generate static file
|
||||
public function generateStaticFile($path, $location, $analyse = false, $probe = false, $error = false) {
|
||||
$this->yellow->content = new YellowContent($this->yellow);
|
||||
$this->yellow->page = new YellowPage($this->yellow);
|
||||
$this->yellow->page->fileName = substru($location, 1);
|
||||
|
@ -151,10 +151,10 @@ class YellowStatic {
|
|||
if ($statusCode>=200) ++$this->files;
|
||||
if ($statusCode>=400) {
|
||||
++$this->errors;
|
||||
echo "\rERROR building location '$location', ".$this->yellow->page->getStatusCode(true)."\n";
|
||||
echo "\rERROR generating location '$location', ".$this->yellow->page->getStatusCode(true)."\n";
|
||||
}
|
||||
if ($this->yellow->system->get("coreDebugMode")>=1) {
|
||||
echo "YellowStatic::buildStaticFile status:$statusCode location:$location<br/>\n";
|
||||
echo "YellowStatic::generateStaticFile status:$statusCode location:$location<br/>\n";
|
||||
}
|
||||
return $statusCode;
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ class YellowStatic {
|
|||
list($scheme, $address, $base) = $this->yellow->lookup->getUrlInformation($staticUrl);
|
||||
$this->yellow->page->setRequestInformation($scheme, $address, $base, "", "", false);
|
||||
foreach ($this->yellow->content->index(true, true) as $page) {
|
||||
if (preg_match("/exclude/i", $page->get("build")) && !$includeAll) continue;
|
||||
if (preg_match("/exclude/i", $page->get("generate")) && !$includeAll) continue;
|
||||
if ($page->get("status")=="private" || $page->get("status")=="draft") continue;
|
||||
array_push($locations, $page->location);
|
||||
}
|
||||
|
|
|
@ -86,21 +86,21 @@ Tag: feature
|
|||
system/extensions/meta.php: meta.php, create, update
|
||||
|
||||
Extension: Static
|
||||
Version: 0.8.49
|
||||
Description: Build a static website.
|
||||
Version: 0.8.50
|
||||
Description: Generate a static website.
|
||||
DocumentationUrl: https://github.com/annaesvensson/yellow-static
|
||||
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/static.zip
|
||||
Published: 2023-05-18 17:56:17
|
||||
Published: 2023-05-25 22:36:53
|
||||
Developer: Anna Svensson
|
||||
Tag: feature
|
||||
system/extensions/static.php: static.php, create, update
|
||||
|
||||
Extension: Serve
|
||||
Version: 0.8.23
|
||||
Version: 0.8.24
|
||||
Description: Built-in web server.
|
||||
DocumentationUrl: https://github.com/annaesvensson/yellow-serve
|
||||
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/serve.zip
|
||||
Published: 2023-04-30 21:53:23
|
||||
Published: 2023-05-25 22:35:15
|
||||
Developer: Anna Svensson
|
||||
Tag: feature
|
||||
system/extensions/serve.php: serve.php, create, update
|
||||
|
|
Loading…
Reference in a new issue