From 89338aeb6154b17e0398774ea7aef272b7359f40 Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Wed, 17 Apr 2024 09:34:29 +0200 Subject: [PATCH] Upgrade phel:0.13 --- README.md | 11 ++++++++--- composer.json | 2 +- example/using-exported-phel-function.php | 7 +++++++ phel-config.php | 6 +++--- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 991dbc5..827a69a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This repository provides you the basic setup to start coding phel. ### Requirements -Phel requires at least PHP 8.0 and Composer. +Phel requires at least PHP 8.2 and Composer. You can either use it from your local machine OR using docker. - This repository contains the basic Dockerfile to run phel. @@ -29,9 +29,14 @@ You can either use it from your local machine OR using docker. ### Phel code 1. Write your phel code in `src/` -1. Execute your code with `vendor/bin/phel run src/main.phel` +1. Run your code with `vendor/bin/phel run src/main.phel` -### Tests +#### Or run the executable transpiled PHP result + +1. `vendor/bin/phel build` +1. `php out/main.php` + +#### Tests 1. Write your phel tests in `tests/` 1. Execute your tests with `./vendor/bin/phel test` diff --git a/composer.json b/composer.json index e521c88..37cfcbf 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "license": "MIT", "require": { "php": ">=8.2", - "phel-lang/phel-lang": "^0.12" + "phel-lang/phel-lang": "^0.13" }, "require-dev": { "symfony/var-dumper": "^6.4" diff --git a/example/using-exported-phel-function.php b/example/using-exported-phel-function.php index 85166dd..6388d8f 100644 --- a/example/using-exported-phel-function.php +++ b/example/using-exported-phel-function.php @@ -10,6 +10,13 @@ Phel::run($projectRootDir, 'cli-skeleton\modules\adder-module'); +################################################### +# Remember to run phel export command to generate +# the PHP classes from the exported phel functions: +# +# $ vendor/bin/phel export +# $ php example/using-exported-phel-function.php +################################################### $adder = new AdderModule(); $result = $adder->adder(1, 2, 3); diff --git a/phel-config.php b/phel-config.php index 4b7657a..d9ee10f 100644 --- a/phel-config.php +++ b/phel-config.php @@ -10,13 +10,13 @@ ->setSrcDirs(['src']) ->setTestDirs(['tests']) ->setOut((new PhelOutConfig()) - ->setDestDir('out') ->setMainPhelNamespace('cli-skeleton\main') - ->setMainPhpFilename('index')) + ->setMainPhpPath('out/main.php')) ->setFormatDirs(['src', 'tests']) ->setExport((new PhelExportConfig()) ->setDirectories(['src/modules']) ->setNamespacePrefix('PhelGenerated') ->setTargetDirectory('src/PhelGenerated')) ->setIgnoreWhenBuilding(['local.phel']) - ->setKeepGeneratedTempFiles(false); + ->setKeepGeneratedTempFiles(false) +;