mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-21 16:13:00 +00:00
Build script: Output some basic progress information
This commit is contained in:
parent
f33fa13aad
commit
9bb97cad5b
2 changed files with 19 additions and 15 deletions
|
@ -42,13 +42,16 @@ function register_module($settings)
|
|||
$module_index[] = $newmodule;
|
||||
}
|
||||
|
||||
$module_count = count($modules);
|
||||
$i = 1;
|
||||
foreach($modules as $filename)
|
||||
{
|
||||
echo("Processing $filename\n");
|
||||
echo("[$i / $module_count] Processing $filename \r");
|
||||
require($filename);
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo("*** Processing complete ***\n");
|
||||
echo("\n*** Processing complete ***\n");
|
||||
|
||||
echo("Writing new module index to disk...");
|
||||
file_put_contents("module_index.json", json_encode($module_index, JSON_PRETTY_PRINT));
|
||||
|
|
27
pack.php
27
pack.php
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
if(php_sapi_name() == "cli")
|
||||
{
|
||||
if(php_sapi_name() == "cli") {
|
||||
echo("*** Beginning main build sequence ***\n");
|
||||
echo("Reading in module index...\n");
|
||||
}
|
||||
|
@ -33,7 +32,7 @@ if(php_sapi_name() != "cli")
|
|||
header("content-disposition: attachment; filename=\"index.php\"");
|
||||
}
|
||||
|
||||
if(php_sapi_name() == "cli") echo("Reading in core files...");
|
||||
if(php_sapi_name() == "cli") echo("Reading in core files...\n");
|
||||
|
||||
$core = file_get_contents("core.php");
|
||||
$settings = file_get_contents("settings.fragment.php");
|
||||
|
@ -54,18 +53,19 @@ $core = str_replace([
|
|||
|
||||
$result = $core;
|
||||
|
||||
$module_list_count = count($module_list);
|
||||
$i = 1;
|
||||
foreach($module_list as $module_id)
|
||||
{
|
||||
if($module_id == "") continue;
|
||||
|
||||
if(php_sapi_name() == "cli") echo("Adding $module_id\n");
|
||||
if(php_sapi_name() == "cli") echo("[$i / $module_list_count] Adding $module_id \r");
|
||||
|
||||
$module_filepath = "modules/" . preg_replace("[^a-zA-Z0-9\-]", "", $module_id) . ".php";
|
||||
|
||||
//echo("id: $module_id | filepath: $module_filepath\n");
|
||||
|
||||
if(!file_exists($module_filepath))
|
||||
{
|
||||
if(!file_exists($module_filepath)) {
|
||||
http_response_code(400);
|
||||
exit("Failed to load module with name: $module_filepath");
|
||||
}
|
||||
|
@ -75,26 +75,27 @@ foreach($module_list as $module_id)
|
|||
$result = str_replace(
|
||||
"// %next_module% //",
|
||||
"$modulecode\n// %next_module% //",
|
||||
$result);
|
||||
$result
|
||||
);
|
||||
|
||||
$i++;
|
||||
}
|
||||
echo("\n");
|
||||
|
||||
if(php_sapi_name() == "cli")
|
||||
{
|
||||
if(file_exists("build/index.php"))
|
||||
{
|
||||
if(file_exists("build/index.php")) {
|
||||
echo("index.php already exists in the build folder, exiting\n");
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
echo("Done. Saving to disk...");
|
||||
file_put_contents("build/index.php", $result);
|
||||
echo("complete!\n");
|
||||
echo("*** Build completed! ***\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
exit($result);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue