From 7c4ca953f6dcd81c63cfd301c413ed34ce79f4f9 Mon Sep 17 00:00:00 2001 From: Christopher Vagnetoft Date: Thu, 6 Jan 2022 17:20:40 +0100 Subject: [PATCH] Tweaks * Added basic http facade * Updated build rules --- .spark/build/package.sh | 12 +++++++----- VERSIONS.md | 5 ++++- runtime/functions.php | 4 +++- runtime/http.php | 17 +++++++++++++++++ 4 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 runtime/http.php diff --git a/.spark/build/package.sh b/.spark/build/package.sh index b17d576..0bcd837 100755 --- a/.spark/build/package.sh +++ b/.spark/build/package.sh @@ -19,6 +19,8 @@ if [ ! -z "$FLAVOR" ]; then fi PATH="$PWD/tools:$PATH" +PLUGINS="plugins/com.noccy.apiclient plugins/com.noccy.pdo plugins/com.noccy.todo plugins/com.noccy.pdo.shell plugins/com.noccy.watcher" + if [ -z $DESTINATION ]; then DESTINATION="release/$VERSION" @@ -34,15 +36,15 @@ cp README.md $DESTINATION/README.md cp VERSIONS.md $DESTINATION/VERSIONS.md echo "* Building dist and source archives" -7z a -tzip "$DESTINATION/spark-$VERSION-dist.zip" spark.phar plugins README.md VERSIONS.md >/dev/null -tar cfz "$DESTINATION/spark-$VERSION-dist.tgz" spark.phar plugins README.md VERSIONS.md -7z a -tzip "$DESTINATION/spark-$VERSION-src.zip" bin src runtime plugins composer.json README.md VERSIONS.md >/dev/null -tar cfz "$DESTINATION/spark-$VERSION-src.tgz" bin src runtime plugins composer.json README.md VERSIONS.md +7z a -tzip "$DESTINATION/spark-$VERSION-dist.zip" spark.phar $PLUGINS README.md VERSIONS.md >/dev/null +tar cfz "$DESTINATION/spark-$VERSION-dist.tgz" spark.phar $PLUGINS README.md VERSIONS.md +7z a -tzip "$DESTINATION/spark-$VERSION-src.zip" bin src runtime $PLUGINS composer.json README.md VERSIONS.md >/dev/null +tar cfz "$DESTINATION/spark-$VERSION-src.tgz" bin src runtime $PLUGINS composer.json README.md VERSIONS.md echo "* Creating makeself installer" test -d release/tmp && rm -rf release/tmp mkdir release/tmp -cp -R spark.phar plugins README.md VERSIONS.md release/tmp/ +cp -R spark.phar $PLUGINS README.md VERSIONS.md release/tmp/ pushd release/tmp &>/dev/null makeself . ../../$DESTINATION/spark-$VERSION-dist.run "Spark $VERSION" ./spark.phar install &>/dev/null popd &>/dev/null diff --git a/VERSIONS.md b/VERSIONS.md index de49b9b..2afd4e0 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -11,5 +11,8 @@ - Rewritten script runner with proper variable substitution. - Added utility libraries for HTTP requests (Guzzle), templating (Twig) and dotenv support (symfony/dotenv, activates with environment). +- PHP REPL; execute PHP code interactively. +- Development mode; script the startup and shutdown of your projects development + environment, and have it start and stop with the dedicated project shell. - Plugins in beta: com.noccy.pdo, com.noccy.pdo.shell, com.noccy.watcher. -- Plugins in alpha: com.noccy.apiclient. +- Plugins in alpha: com.noccy.apiclient, com.noccy.todo. diff --git a/runtime/functions.php b/runtime/functions.php index 1f25b74..7c619d0 100644 --- a/runtime/functions.php +++ b/runtime/functions.php @@ -122,4 +122,6 @@ function get_filter(string $name, array $args=[]): null|FilterInterface|callable $filter->setArguments($args); } return $filter; -} \ No newline at end of file +} + +require_once __DIR__."/http.php"; diff --git a/runtime/http.php b/runtime/http.php new file mode 100644 index 0000000..27f07d8 --- /dev/null +++ b/runtime/http.php @@ -0,0 +1,17 @@ +request($method, $url, $options); + + if ($returnResponse) { + return $response; + } + return (string)$response->getBody(); + +}