commit 0c652e80cfb94d8d399880efe621e39b8c330947 Author: Pavel Shevaev Date: Wed May 18 10:39:08 2022 +0300 first version 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; +}