public function deploy() { /** * POST /apps/deploy -d * { * branch : master, * ref : tag/commit-hash, * name : foobar * } * Creates : * $appPath/deploy/foobar/ <- full repo */ $id = $this->request->id; $app = App::first($id); if ($this->request->data) { $deploy = $app->deploy($this->request->data); $repo = $app->repo(); $deploy->checkout(compact('repo')); $this->redirect('Apps::view', array('args' => compact('id'))); } $refs = array(); foreach ($app->repo()->refs(100) as $r) { extract($r); $refs[$hash] = "{$date} : {$message}"; } $branches = $app->repo()->branches(); //$versions = $app->versions(); $deployed = $app->deployed(); if (!count($deployed)) { $defaults = array('target' => "/home/apps/" . strtolower($app->title), 'name' => 'default'); } return compact('app', 'refs', 'defaults'); }