0fb7c931c500abb419048b7d6811ac0c6b1f52e2
Author: gwoo
Date: 2009-12-15 18:28:56 -0800
diff --cc controllers/projects_controller.php
index 8374c4d,b44365c..836e232
--- a/controllers/projects_controller.php
+++ b/controllers/projects_controller.php
@@@ -93,8 -121,14 +121,14 @@@ class ProjectsController extends AppCon
$this->set('project', $project);
}
+ /**
+ * undocumented function
+ *
+ * @param string $type
+ * @return void
+ */
function start($type = null) {
- $this->pageTitle = 'Projects/Start';
+ $this->set('title_for_layout', 'Projects/Start');
if ($type || !empty($this->data)) {
$this->add();
return;
@@@ -248,9 -308,14 +308,14 @@@
$this->set('projects', $this->paginate());
}
+ /**
+ * undocumented function
+ *
+ * @return void
+ */
function admin_add() {
- $this->pageTitle = 'Project Setup';
+ $this->set('title_for_layout', 'Project Setup');
if ($this->Project->id !== '1' && $this->params['isAdmin'] !== true) {
$this->redirect($this->referer());
diff --cc controllers/repo_controller.php
index 32c7c29,0f5cb8f..ecf13b1
--- a/controllers/repo_controller.php
+++ b/controllers/repo_controller.php
@@@ -61,17 -80,11 +80,27 @@@ class RepoController extends AppControl
$this->redirect($this->referer());
}
+ /**
+ * undocumented function
+ *
+ * @return void
+ */
+ function rebase() {
+ if (!empty($this->params['isAdmin'])) {
+ if ($this->Project->Repo->rebase()) {
+ $this->Session->setFlash(__('You should have a nice clean working copy',true));
+ } else {
+ $this->Session->setFlash(__('Oops, rebuild failed try again',true));
+ }
+ }
+ $this->redirect(array('controller' => 'source', 'action' => 'index'));
+ }
+
++ /**
++ * undocumented function
++ *
++ * @return void
++ */
function fork_it() {
if ($this->Project->Repo->type != 'git') {
$this->Session->setFlash(__('You cannot fork an svn project',true));
diff --cc controllers/source_controller.php
index c8b23cf,62cbfa2..85e637f
--- a/controllers/source_controller.php
+++ b/controllers/source_controller.php
@@@ -47,15 -47,15 +47,17 @@@ class SourceController extends AppContr
} else {
$this->Project->Repo->update();
}
-
+
list($args, $path, $current) = $this->Source->initialize($this->Project->Repo, $args);
-- $data = $this->Source->read($path);
-
- $this->set('title_for_layout', $current);
++ $title = $current;
+
- $this->pageTitle = $current;
if (!empty($args)) {
- $this->set('title_for_layout', join('/', $args) . '/' . $current);
- $this->pageTitle = join('/', $args) . '/' . $current;
++ $title = join('/', $args) . '/' . $current;
}
++ $this->set('title_for_layout', $title);
++
++ $data = $this->Source->read($path);
$this->set(compact('data', 'path', 'args', 'current'));
}
@@@ -85,12 -86,29 +88,12 @@@
$this->render('index');
}
- /**
- * undocumented function
- *
- * @return void
- *
- **/
+ /**
+ * undocumented function
+ *
+ * @return void
+ *
+ */
- function rebase() {
- if (!empty($this->params['isAdmin'])) {
- if ($this->Source->rebase()) {
- $this->Session->setFlash(__('You should have a nice clean working copy',true));
- } else {
- $this->Session->setFlash(__('Oops, rebuild failed try again',true));
- }
- }
- $this->redirect($this->referer());
- }
-
- /**
- * undocumented function
- *
- * @return void
- *
- */
function delete($branch = null) {
$this->autoRender = false;
if (!empty($branch) && !empty($this->params['isAdmin'])) {
diff --cc controllers/tickets_controller.php
index 3697de7,58f7b1d..4fb8818
--- a/controllers/tickets_controller.php
+++ b/controllers/tickets_controller.php
@@@ -159,9 -193,15 +193,15 @@@ class TicketsController extends AppCont
}
}
- $this->redirect(array('action' => 'view', $id));
+ $this->redirect(array('action' => 'view', $this->data['Ticket']['number']));
}
+ /**
+ * undocumented function
+ *
+ * @param string $all
+ * @return void
+ */
function _ticketInfo($all = true) {
if ($all) {
$versions = $this->Ticket->Version->find('list', array(
diff --cc controllers/versions_controller.php
index f502adf,d968b36..b359911
--- a/controllers/versions_controller.php
+++ b/controllers/versions_controller.php
@@@ -52,8 -74,13 +76,13 @@@ class VersionsController extends AppCon
$this->render('index');
}
+ /**
+ * undocumented function
+ *
+ * @return void
+ */
function admin_add() {
- $this->pageTitle = __("New Version",true);
+ $this->set('title_for_layout', __("New Version",true));
if (!empty($this->data)) {
$this->Version->create(array('project_id' => $this->Project->id));
diff --cc controllers/wiki_controller.php
index e778186,d85d8dd..a2f5bf8
--- a/controllers/wiki_controller.php
+++ b/controllers/wiki_controller.php
@@@ -190,8 -207,13 +207,13 @@@ class WikiController extends AppControl
$this->set(compact('path', 'slug'));
}
+ /**
+ * undocumented function
+ *
+ * @return void
+ */
function edit() {
- $this->pageTitle = 'Wiki/edit/';
+ $this->set('title_for_layout', 'Wiki/edit/');
$this->add();
$this->render('add');
}
diff --cc models/commit.php
index 33d120c,58fd4b2..1ee7b5d
--- a/models/commit.php
+++ b/models/commit.php
@@@ -63,7 -88,15 +88,13 @@@ class Commit extends AppModel
return true;
}
- function afterSave($created) {
+ /**
+ * undocumented function
+ *
+ * @param string $created
+ * @return void
+ */
+ function afterSave($created) {
- $this->log($this->data);
-
if ($created && $this->addToTimeline) {
$Timeline = ClassRegistry::init('Timeline');
$timeline = array('Timeline' => array(
diff --cc models/project.php
index 9602012,5f979c2..93018d0
--- a/models/project.php
+++ b/models/project.php
@@@ -172,24 -182,21 +182,24 @@@ class Project extends AppModel
if ($repoType == 'git') {
$this->current['repo']['path'] .= '.git';
}
- if (!empty($this->current['config']) && is_string($this->current['config']) && substr($this->current['config'], 0, 3) === "a:2") {
+
+ if (!empty($this->current['config']) && is_string($this->current['config']) && substr($this->current['config'], 0, 3) == "a:2") {
$this->current['config'] = unserialize($this->current['config']);
}
+
$this->id = $this->current['id'];
Configure::write('Project', $this->current);
-
- $this->Repo = ClassRegistry::init($this->current['repo']);
+
+ App::import('Model', $this->current['repo']['class'], false);
+ $this->Repo = new $this->current['repo_type']($this->current['repo']);
return true;
}
- /**
- * undocumented function
- *
- * @return void
- *
- **/
+
+ /**
+ * undocumented function
+ *
+ * @return void
+ */
function beforeValidate() {
if (!empty($this->data['Project']['name']) && empty($this->data['Project']['url'])) {
$this->data['Project']['url'] = Inflector::slug(strtolower($this->data['Project']['name']));
@@@ -359,17 -369,12 +372,25 @@@
return $result;
}
+ /**
+ * undocumented function
+ *
++ * @param string $fields
++ * @param string $id
++ * @return void
++ */
+ function read($fields = null, $id = null) {
+ $data = parent::read($fields, $id);
+ $data['Project']['config'] = unserialize($data['Project']['config']);
+ return $data;
+ }
- /**
- * undocumented function
- *
- * @return void
- *
- **/
++
++ /**
++ * undocumented function
++ *
+ * @param string $data
+ * @return void
+ */
function createShell($data = array()) {
$template = CONFIGS . 'templates' . DS;
diff --cc models/tag.php
index 2b97d06,2c3ca43..e84d1a6
--- a/models/tag.php
+++ b/models/tag.php
@@@ -16,12 -13,33 +13,33 @@@
*/
class Tag extends AppModel {
+ /**
+ * undocumented variable
+ *
+ * @var string
+ */
var $name = 'Tag';
+ /**
+ * undocumented variable
+ *
+ * @var string
+ */
- var $validate = array('name' => VALID_NOT_EMPTY);
+ var $validate = array('name' => 'notEmpty');
+ /**
+ * undocumented variable
+ *
+ * @var string
+ */
var $hasAndBelongsToMany = array('Ticket');
+ /**
+ * undocumented function
+ *
+ * @param string $string
+ * @return void
+ */
function generate($string = null) {
$return = array();
if($string) {
diff --cc plugins/repo/models/repo.php
index 33fde7e,53cc4ff..8bb8b76
--- a/plugins/repo/models/repo.php
+++ b/plugins/repo/models/repo.php
@@@ -296,15 -301,15 +301,15 @@@ class Repo extends Overloadable
break;
}
}
-
+
return $results;
}
- /**
- * Create the parent folders for a repository
- *
- * @return void
- *
- **/
+
+ /**
+ * Create the parent folders for a repository
+ *
+ * @return boolean
+ */
function _create($options = array(), $return = false) {
extract(array_merge($this->config, $options));
@@@ -324,35 -329,22 +329,36 @@@
return false;
}
- /**
- * Deletes branch are resets
- *
- * @return void
- *
- **/
++
++ /**
++ * Deletes branch are resets
++ *
++ * @return void
++ *
++ */
+ function _rebase() {
+ $Cleanup = new Folder($this->working);
+ if ($Cleanup->pwd() == $this->working) {
+ $Cleanup->delete();
+ }
+ return $this->pull();
+ }
- /**
- * Creates a hook
- *
- * @param string $name
- * GIT
- * applypatch-msg, commit-message, post-commit, post-receive, post-update,
- * pre-applypatch, pre-commit, pre-rebase, update)
- *
- * SVN
- * post-commit, post-lock, post-revprop-change, post-unlock, pre-commit, pre-lock,
- * pre-revprop-change, pre-unlock, start-commit
- *
- * @param string $data location of the repository
- * @return void
- *
- **/
+
+ /**
+ * Creates a hook
+ *
+ * @param string $name
+ * GIT
+ * applypatch-msg, commit-message, post-commit, post-receive, post-update,
+ * pre-applypatch, pre-commit, pre-rebase, update)
+ *
+ * SVN
+ * post-commit, post-lock, post-revprop-change, post-unlock, pre-commit, pre-lock,
+ * pre-revprop-change, pre-unlock, start-commit
+ *
+ * @param string $data location of the repository
+ * @return boolean
+ */
function _hook($name, $data = null, $options = array()) {
extract($this->config);
$Hook = new File($path . DS . 'hooks' . DS . $name, true, $chmod);
diff --cc plugins/repo/tests/cases/models/git.test.php
index e5c5abd,53d4ca2..db64849
--- a/plugins/repo/tests/cases/models/git.test.php
+++ b/plugins/repo/tests/cases/models/git.test.php
@@@ -1,8 -1,12 +1,14 @@@
<?php
- /* SVN FILE: $Id$ */
- /* Git Test cases generated on: 2008-09-09 18:09:14 : 1220999054*/
+ /**
+ * Chaw : source code and project management
+ *
+ * @copyright Copyright 2009, Garrett J. Woodworth (gwoohoo@gmail.com)
+ * @license GNU AFFERO GENERAL PUBLIC LICENSE v3 (http://opensource.org/licenses/agpl-v3.html)
+ *
+ */
+
+App::import('Model', 'Repo.Git', false);
+
class GitTest extends CakeTestCase {
function startTest() {
diff --cc plugins/repo/tests/cases/models/repo.test.php
index fe25554,45a318d..064cc62
--- a/plugins/repo/tests/cases/models/repo.test.php
+++ b/plugins/repo/tests/cases/models/repo.test.php
@@@ -1,5 -1,13 +1,13 @@@
<?php
+ /**
+ * Chaw : source code and project management
+ *
+ * @copyright Copyright 2009, Garrett J. Woodworth (gwoohoo@gmail.com)
+ * @license GNU AFFERO GENERAL PUBLIC LICENSE v3 (http://opensource.org/licenses/agpl-v3.html)
+ *
+ */
+
-App::import('Model', array('Repo.Git', 'Repo.Svn'));
+App::import('Model', array('Repo.Git', 'Repo.Svn'), false);
class TestRepo extends Repo {
diff --cc plugins/repo/tests/cases/models/svn.test.php
index 3754280,dca74a3..d7ecc0c
--- a/plugins/repo/tests/cases/models/svn.test.php
+++ b/plugins/repo/tests/cases/models/svn.test.php
@@@ -1,9 -1,12 +1,14 @@@
<?php
- /* SVN FILE: $Id$ */
- /* Svn Test cases generated on: 2008-08-28 13:08:20 : 1219956320*/
+ /**
+ * Chaw : source code and project management
+ *
+ * @copyright Copyright 2009, Garrett J. Woodworth (gwoohoo@gmail.com)
+ * @license GNU AFFERO GENERAL PUBLIC LICENSE v3 (http://opensource.org/licenses/agpl-v3.html)
+ *
+ */
+App::import('Model', 'Repo.Svn', false);
+
class SvnTest extends CakeTestCase {
function setUp() {
diff --cc tests/cases/components/access.test.php
index 81cdd31,8079f84..dd68cdd
--- a/tests/cases/components/access.test.php
+++ b/tests/cases/components/access.test.php
@@@ -1,9 -1,15 +1,15 @@@
<?php
- /* SVN FILE: $Id$ */
- /* Access Test cases generated on: 2008-11-01 10:11:29 : 1225561949*/
+ /**
+ * Chaw : source code and project management
+ *
+ * @copyright Copyright 2009, Garrett J. Woodworth (gwoohoo@gmail.com)
+ * @license GNU AFFERO GENERAL PUBLIC LICENSE v3 (http://opensource.org/licenses/agpl-v3.html)
+ *
+ */
+
App::import('Component', array('Auth', 'Session', 'Access'));
App::import('Controller');
-App::import('Model', array('Project', 'Permission'));
+App::import('Model', array('Project', 'Permission'), true);
class TestAccess extends AccessComponent {
}
diff --cc vendors/shells/pre_commit.php
index e9bba29,afd15a2..7ef14cf
--- a/vendors/shells/pre_commit.php
+++ b/vendors/shells/pre_commit.php
@@@ -23,13 -30,18 +30,18 @@@ class PreCommitShell extends Shell
function main() {
return $this->authorize();
}
-
+
+ /**
+ * undocumented function
+ *
+ * @return void
+ */
function authorize() {
$this->args[] = 'pre_commit';
- $this->log($this->args, LOG_DEBUG);
+ CakeLog::write(LOG_DEBUG, $this->args);
return 0;
-
-
+
+
$this->error(print_r($this->args, true));
die();
