From 725a9c2bd864c11b4d81a44b08401fd801ae2d7e Mon Sep 17 00:00:00 2001 From: Erika Heidi Date: Thu, 8 May 2014 15:05:34 +0200 Subject: [PATCH] hook script now working --- logs/.gitignore | 2 ++ webtools/github/index.php | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 logs/.gitignore diff --git a/logs/.gitignore b/logs/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/logs/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/webtools/github/index.php b/webtools/github/index.php index 39e7043..2cbc2f4 100644 --- a/webtools/github/index.php +++ b/webtools/github/index.php @@ -3,6 +3,7 @@ require_once __DIR__ . '/../../vendor/autoload.php'; $app = new Silex\Application(); +$app['debug'] = true; $app->get('/', function () use ($app) { return 'Nothing to see here.'; @@ -14,6 +15,21 @@ * 1 - cd to /dev-human/dev-human and pull from main repo * 2 - run the sculpin command and generate the prod output */ + + $local_path = "/www/dev-human/dev-human"; + //$local_path = "/home/erika/Projects/dev-human"; + $update_log = __DIR__ . '/../../logs/update.log'; + + shell_exec("cd $local_path && git pull 2>&1"); + shell_exec("cd $local_path && sculpin generate --env=prod 2>&1"); + + $fp = fopen($update_log, "a+"); + if ($fp !== false) { + fwrite($fp, date('[Y-m-d H:i:s]') . " Updated production website.\n"); + fclose($fp); + } + + return new \Symfony\Component\HttpFoundation\Response("Done."); }); $app->run(); \ No newline at end of file