Skip to content

Commit

Permalink
feature: add setup.php to configure manually installed applications
Browse files Browse the repository at this point in the history
closes #578
  • Loading branch information
g105b committed Sep 30, 2022
1 parent 0962ecb commit 1123773
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions setup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Run this script from the root directory of your WebEngine project.
* e.g. php vendor/phpgt/webengine/setup.php
*
* The purpose of this script is to make sure that the project is set up
* correctly, if it has been installed manually, rather than via the composer
* create-project command.
*/
$error = null;
if(!is_dir("vendor")) {
if(!is_file("composer.json")) {
$error = "The current directory is not a WebEngine project.";
}
$error = "No vendor directory found - do you need to run `composer install`?";
}
if(is_file("build.default.json")) {
$error = "Please run this script from your project's root directory.";
}
if($error) {
echo "$error See https://www.php.gt/webengine/setup for more information.", PHP_EOL;
exit(1);
}
$indexPhpContents = <<<PHP
<?php
require(__DIR__ . "/../vendor/phpgt/webengine/go.php");
PHP;

if(!is_dir("www")) {
mkdir("www");
}
file_put_contents("www/index.php", $indexPhpContents);

0 comments on commit 1123773

Please sign in to comment.