From 0c652e80cfb94d8d399880efe621e39b8c330947 Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Wed, 18 May 2022 10:39:08 +0300 Subject: [PATCH] first version --- composer.json | 11 +++++++++++ deps.inc.php | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 composer.json create mode 100644 deps.inc.php diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..da49571 --- /dev/null +++ b/composer.json @@ -0,0 +1,11 @@ +{ + "name": "bit/taskman_deps", + "description": "taskman deps utils", + "homepage": "https://git.bit5.ru/composer/taskman_deps", + "require": { + "php": ">=7.4" + }, + "autoload": { + "classmap": ["deps.inc.php"] + } +} diff --git a/deps.inc.php b/deps.inc.php new file mode 100644 index 0000000..26cfdeb --- /dev/null +++ b/deps.inc.php @@ -0,0 +1,36 @@ + true], function() +{ + global $GAME_ROOT; + + if(try_update_composer()) + echo "Composer was updated...\n"; + + if(file_exists("$GAME_ROOT/composer/vendor/composer/autoload_real.php")) + include_once("$GAME_ROOT/composer/vendor/autoload.php"); +}); + +task('deps_update', function() +{ + update_composer(); +}); + +function update_composer() +{ + global $GAME_ROOT; + include("$GAME_ROOT/composer/update.php"); +} + +function try_update_composer() +{ + global $GAME_ROOT; + + if(!need_to_regen("$GAME_ROOT/composer/composer.last", ["$GAME_ROOT/composer/composer.json"])) + return false; + + update_composer(); + touch("$GAME_ROOT/composer/composer.last"); + return true; +}