From 3281884187740de8f8fba1a2aaf4ae6df409466c Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 16 Jan 2019 14:35:56 +0800 Subject: [PATCH] buildSDK/pre-commit --- buildSDK/pre-commit | 147 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 141 insertions(+), 6 deletions(-) diff --git a/buildSDK/pre-commit b/buildSDK/pre-commit index e3aab9c40f..558ae91afe 100755 --- a/buildSDK/pre-commit +++ b/buildSDK/pre-commit @@ -1,12 +1,147 @@ #!/usr/bin/php 3) { + exit; + } + } + file_put_contents(".git/pre-commit-running","\n"); +} +function unlock() +{ + unlink(".git/pre-commit-running"); +} + + +function changed_files() +{ + static $output = array(); + if (!empty($output)) { + return $output; + } + $return = 0; + exec('git rev-parse --verify HEAD 2> /dev/null', $output, $return); + if ($return != 0) { + exit; + } + + exec("git diff-index --cached --name-only 'HEAD'", $output); + return $output; +} + + +function trigger_action($fn, $files) +{ + $changed = changed_files(); + foreach(changed_files() as $cg) { + foreach($files as $f) { + if ($f == $cg) { + $fn(); + return true; + } + if (substr($f, -1,1) == '/' && substr($cg,0, strlen($f)) == $f) { + $fn(); + return true; + } + } + } + return false; +} + +function build_docs() +{ + exec("roojspacker -i buildSDK/dependancy_core.txt -i buildSDK/dependancy_ui.txt " . + "-i buildSDK/dependancy_bootstrap.txt -i buildSDK/dependancy_calendar.txt " . + "--doc-target=docs -D"); } -file_put_contents("/tmp/commitlog.txt", implode("\n", $ar)); - +function compile_core() +{ + exec("roojspacker -t roojs-core.js -T roojs-core-debug.js -i buildSDK/dependancy_core.txt "); +} + +function compile_ui() +{ + exec("roojspacker -t roojs-ui.js -T roojs-ui-debug.js -i buildSDK/dependancy_ui.txt"); +} + +function merge_files() +{ + exec("cat roojs-core.js roojs-ui.js > roojs-all.js"); + exec("cat roojs-core-debug.js roojs-ui-debug.js > roojs-debug.js"); +} + + +function compile_bootstrap() +{ + exec("roojspacker -t roojs-bootstrap.js -T roojs-bootstrap-debug.js -i buildSDK/dependancy_bootstrap.txt"); +} + +function compile_calendar() +{ + exec("roojspacker -t roojs-calendar.js -T roojs-calendar-debug.js -i buildSDK/dependancy_calendar.txt"); +} + + +function compile_mailer() +{ + + exec("roojspacker -t roojs-mailer.js -T roojs-mailer-debug.js -i buildSDK/dependancy_mailer.txt"); +} + +function compile_docbook() +{ + exec("roojspacker -t roojs-doc.js -T roojs-doc-debug.js -i buildSDK/dependancy_doc.txt"); +} + + + +function compile_less() +{ + exec("php buildSDK/less-bootstrap-complier.php"); +} + +function compile_scss() +{ + exec("php buildSDK/scss-bootstrap.php"); +} + + + + + + \ No newline at end of file -- 2.39.2