0f4c6d5f8bfe21e2183b8e0f37abd287347d0488
Author: AD7six
Date: 2010-02-14 23:21:00 +0100
diff --git a/cakemate_app_controller.php b/cakemate_app_controller.php
deleted file mode 100644
index 0d2a871..0000000
--- a/cakemate_app_controller.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/**
- * Short description for cakemate_app_controller.php
- *
- * Long description for cakemate_app_controller.php
- *
- * PHP version 4 and 5
- *
- * Copyright (c) 2009, Andy Dawson
- *
- * Licensed under The MIT License
- * Redistributions of files must retain the above copyright notice.
- *
- * @copyright Copyright (c) 2009, Andy Dawson
- * @link www.ad7six.com
- * @package cakemate
- * @subpackage cakemate
- * @since v 1.0 (11-Feb-2009)
- * @license http://www.opensource.org/licenses/mit-license.php The MIT License
- */
-
-/**
- * CakemateAppController class
- *
- * @package cakemate
- * @subpackage cakemate
- */
-class CakemateAppController extends AppController {
-}
-?>
\ No newline at end of file
diff --git a/cakemate_app_model.php b/cakemate_app_model.php
deleted file mode 100644
index f2be1d3..0000000
--- a/cakemate_app_model.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * Short description for cakemate_app_model.php
- *
- * Long description for cakemate_app_model.php
- *
- * PHP version 4 and 5
- *
- * Copyright (c) 2009, Andy Dawson
- *
- * Licensed under The MIT License
- * Redistributions of files must retain the above copyright notice.
- *
- * @copyright Copyright (c) 2009, Andy Dawson
- * @link www.ad7six.com
- * @package cakemate
- * @subpackage cakemate
- * @since v 1.0 (11-Feb-2009)
- * @license http://www.opensource.org/licenses/mit-license.php The MIT License
- */
-
-/**
- * CakemateAppModel class
- *
- * @uses AppModel
- * @package cakemate
- * @subpackage cakemate
- */
-class CakemateAppModel extends AppModel {
-}
-?>
\ No newline at end of file
diff --git a/config/editor.php b/config/editor.php
index 15270cd..b6807d3 100644
--- a/config/editor.php
+++ b/config/editor.php
@@ -11,7 +11,7 @@
* 'git' (no svn headers)
* 'cake' (Headers for the cake core)
* nl - The new line character "\n". Change if appropriate
- * userName - Your username as it should appear in Class file headers. Defaults to 'YourNameOrCompany'
+ * name - Your name as it should appear in Class file headers. Defaults to 'YourNameOrCompany'
* website - Your website as it should appear in Class file headers. Defaults to 'www.yoursite.com'
*
* You can also add any othe variables you want to be able to use in your doc block headers, or even embed logic in
diff --git a/vendors/cakemate_reporter.php b/vendors/cakemate_reporter.php
index e80dae8..69846f1 100644
--- a/vendors/cakemate_reporter.php
+++ b/vendors/cakemate_reporter.php
@@ -10,11 +10,11 @@
*/
class CakemateReporter extends HtmlReporter {
- function CakemateReporter($characterSet = 'UTF-8') {
+ public function CakemateReporter($characterSet = 'UTF-8') {
parent::HtmlReporter($characterSet);
}
- function paintHeader($testName) {
+ public function paintHeader($testName) {
list($testfile, $extension) = preg_split('/\.test\.php/', $_ENV['TM_FILENAME']);
$testfile = Inflector::humanize($testfile);
@@ -25,7 +25,7 @@
flush();
}
- function paintFooter($testName) {
+ public function paintFooter($testName) {
$colour = ($this->getFailCount() + $this->getExceptionCount() > 0 ? "red" : "green");
print "</table>\n";
print "<div style=\"";
@@ -37,7 +37,7 @@
print "</div>\n";
}
- function paintPass($message) {
+ public function paintPass($message) {
parent::paintPass($message);
echo "<tr>\n\t<td width=\"20\" style=\"border: dotted 1px; border-top: hidden; border-left: hidden; border-right: hidden\">\n";
print "\t\t<span style=\"color: green;\">Pass</span>: \n";
@@ -52,7 +52,7 @@
echo "\n\t</td>\n</tr>\n\n";
}
- function paintFail($message) {
+ public function paintFail($message) {
echo "\n<!-- ";
parent::paintFail($message);
echo " -->\n";
@@ -66,7 +66,7 @@
echo "\n\t</td>\n</tr>\n\n";
}
- function _getCss() {
+ protected function _getCss() {
return parent::_getCss() . ' .pass { color: green; }';
}
diff --git a/vendors/mi.php b/vendors/mi.php
index f203447..851f9ad 100644
--- a/vendors/mi.php
+++ b/vendors/mi.php
@@ -6,7 +6,7 @@
*
* Long description for mi.php
*
- * PHP versions 4 and 5
+ * PHP version 5
*
* Copyright (c) 2008, Andy Dawson
*
@@ -543,7 +543,7 @@ class Mi {
* @return void
* @access public
*/
- function views($controllerName, $plugin = null, $excludePatterns = array('/admin.*/'), $nameOnly = true) {
+ public function views($controllerName, $plugin = null, $excludePatterns = array('/admin.*/'), $nameOnly = true) {
if (is_array($plugin)) {
extract(am(array('plugin' => null), $plugin));
}
diff --git a/vendors/shells/editor.php b/vendors/shells/editor.php
index d2dd5c4..3841375 100644
--- a/vendors/shells/editor.php
+++ b/vendors/shells/editor.php
@@ -35,7 +35,17 @@ class EditorShell extends Shell {
* @var array
* @access public
*/
- var $tasks = array('Base', 'Doc', 'DocFile', 'DocFolder', 'Inflect', 'Path', 'Paths', 'Check', 'Tags');
+ public $tasks = array(
+ 'Base',
+ 'Config',
+ 'Doc',
+ 'DocFile',
+ 'DocFolder',
+ 'Inflect',
+ 'Path',
+ 'Paths',
+ 'Tags'
+ );
/**
* settings property
@@ -46,7 +56,7 @@ class EditorShell extends Shell {
* templatePath - the absolute path to the view folder where your documentation templates are.
* Defaults to the views folder in the plugin itself
* nl - The new line character "\n". Can be overriden if appropriate (in config/editor.php)
- * userName - Your username as it should appear in Class file headers. Can be overriden if
+ * name - Your username as it should appear in Class file headers. Can be overriden if
* appropriate (in config/editor.php)
* website - Your website as it should appear in Class file headers. Can be overriden if
* appropriate (in config/editor.php)
@@ -59,7 +69,7 @@ class EditorShell extends Shell {
'configPaths' => array(),
'templatePath' => null,
'nl' => "\n",
- 'userName' => 'YourNameOrCompany',
+ 'name' => 'YourNameOrCompany',
'website' => 'www.yoursite.com',
'app' => null,
'root' => null,
@@ -84,7 +94,7 @@ class EditorShell extends Shell {
* @return void
* @access public
*/
- public function debug($what = null, $indent = "\t") {
+ public function debug($what = null, $indent = "\t") { //@ignore
if ($this->args && $this->args[0] === 'help') {
return $this->help();
}
@@ -96,7 +106,7 @@ class EditorShell extends Shell {
foreach($what as $key => $val) {
if (is_array($val)) {
$this->out($indent . $key . ' => (');
- $this->debug($val, $indent . "\t");
+ $this->debug($val, $indent . "\t"); //@ignore
$this->out($indent . ')');
continue;
}
@@ -138,7 +148,7 @@ class EditorShell extends Shell {
* @access public
*/
public function initialize() {
- if (file_exists(CONFIGS . 'routes.php')) {
+ if (file_exists(CONFIGS . 'routes.php') || file_exists(CONFIGS . 'core.php')) {
$this->settings['configPaths'][] = CONFIGS;
}
$this->settings['configPaths'][] = dirname(dirname(dirname(__FILE__))) . DS . 'config' . DS;
@@ -163,7 +173,7 @@ class EditorShell extends Shell {
* @return void
* @access public
*/
- function junk() {
+ public function junk() {
if ($this->args && $this->args[0] === 'help') {
return $this->help();
}
@@ -194,7 +204,7 @@ class EditorShell extends Shell {
* @return void
* @access public
*/
- function main() {
+ public function main() {
$this->help();
}
@@ -218,15 +228,15 @@ class EditorShell extends Shell {
}
if ($this->__configFile) {
include($this->__configFile);
- if (!isset($settings)) {
- trigger_error('Editor::_loadSettings The config file was found but no $settings detected');
+ if (!isset($config)) {
+ trigger_error('Editor::_loadSettings The config file was found but no $config detected');
return false;
}
- $settings = am($this->settings, $settings);
- if (!$settings['templatePath']) {
- $settings['templatePath'] = $this->settings['templatePath'];
+ $config = am($this->settings, $config);
+ if (!$config['templatePath']) {
+ $config['templatePath'] = $this->settings['templatePath'];
}
- $this->settings = $settings;
+ $this->settings = $config;
}
}
diff --git a/vendors/shells/go.php b/vendors/shells/go.php
index a2827a1..43edb52 100644
--- a/vendors/shells/go.php
+++ b/vendors/shells/go.php
@@ -7,14 +7,14 @@ class GoShell extends Shell {
* @var array
* @access public
*/
- var $tasks = array('ToController', 'ToModel');
+ public $tasks = array('ToController', 'ToModel');
/**
* Main execution function
*
* @return void
*/
- function main() {
+ public function main() {
// All functionality is carried out in the associated tasks.
}
@@ -22,7 +22,7 @@ class GoShell extends Shell {
* Display help contents
*
*/
- function help() {
+ public function help() {
$this->out('CakeMate Commands');
$this->hr();
$this->out('The CakeMate shells and tasks allow for a more seamless integration between the CakePHP Framework and the CakePHP TextMate Bundle');
diff --git a/vendors/shells/tasks/base.php b/vendors/shells/tasks/base.php
index 905a320..0069943 100644
--- a/vendors/shells/tasks/base.php
+++ b/vendors/shells/tasks/base.php
@@ -95,7 +95,7 @@ class BaseTask extends Shell {
* @return void
* @access public
*/
- function initialize() {
+ public function initialize() {
foreach ($this->settings['signatureFiles'] as $key => &$val) {
$val = str_replace('DS', DS, $val);
}
diff --git a/vendors/shells/tasks/check.php b/vendors/shells/tasks/check.php
deleted file mode 100644
index e8c4e94..0000000
--- a/vendors/shells/tasks/check.php
+++ /dev/null
@@ -1,359 +0,0 @@
-<?php
-/**
- * Short description for check.php
- *
- * Long description for check.php
- *
- * PHP version 4 and 5
- *
- * Copyright (c) 2009, Andy Dawson
- *
- * Licensed under The MIT License
- * Redistributions of files must retain the above copyright notice.
- *
- * @copyright Copyright (c) 2009, Andy Dawson
- * @link www.ad7six.com
- * @package
- * @subpackage
- * @since v 1.0 (30-Apr-2009)
- * @license http://www.opensource.org/licenses/mit-license.php The MIT License
- */
-
-/**
- * CheckTask class
- *
- * @uses Shell
- * @package
- * @subpackage
- */
-class CheckTask extends Shell {
-
-/**
- * settings property
- *
- * @var array
- * @access public
- */
-
- var $settings = array(
- 'welcomeText' => null,
- 'phpFiles' => '/\.php$|\.ctp$|\.js$|\.css$/'
- );
-/**
- * Nested array of type => pattern => error message
- * OR
- * Nested array of type => pattern => array(error message, vim command to fix it)
- *
- * Types:
- * start runs on line 1 only
- * each runs for all lines
- * end runs for the last line only
- * whole runs on the whole file (as a single string) at once
- * Pattern: a preg pattern, or the name of a valid callback
- * Message: The message as displayed for a match (i.e. something that needs fixing)
- * This script doesn't run on comment blocks, and will skip anything commented out (or try to)
- **/
- var $patterns = array(
- 'whole' => array(
- // Allow a file to be marked to skip all tests, such as config/acl.ini.php
- '/@noverify/' => '@noverify marker found - file skipped',
- ),
- 'start' => array(
- '/^\s/' => array('Leading whitespace'),
- 'noOpenPhpTag' => array('No php tag found on the first line'),
- ),
- 'each' => array(
- '/(?!\*)[ \t]$/' => array('Trailing whitespace', ':%s/\(\*\)\@<!\s\+$//g'),
- '/^ {2,}/' => array('Space Indented', ':%s/^\(\t*\) \{4}/\1\t/gc'),
- '/
/' => array('Windows...', ':%s/
//g'),
- '/^([<>])\1{6} |^= {7}$/' => array('Unresolved merge conflict'),
- 'doubleEmpty' => array('Two or more empty lines found', ':v/./,/./-j'),
- '/@nocommit/' => '@nocommit marker found',
- '/^\(\t\|\s+\)\/\*/' => array('Indented comment head', ':%s/^\s*\/\*/\/\*/g'),
- '/^\s{2,}\*/' => array('Indented comment block', ':%s/^\s\+\*/ \*/g'),
- 'Code', // Marker for Code checks
- // So long as it's not inside a string
- '/[^\'\"]*function &?\w+ \(/' => array('Space between function name and first bracket in function declaration', ''),
- '/[^\'\"]*function.*\( /' => array('Space before first parameter in function declaration', '%s/( \+/(/'),
- '/[^\'\"]*function.*\ ,/' => array('Space before comma in function declaration', '%s/ +,/,/'),
- '/[^\'\"]*function.*\,[^ \'"].+/' => array('No Space found after comma in function declaration', ':%s/,\([^ ]\)/, \1/'),
- '/[^\'\"]*function.* \)/' => array('Space before closing parenthases in function declaration', ':%s/ \+)/)/'),
- '/\){/' => array('No Space between closing parenteses and curly brace', ':%s/){/) {/'),
- // Below rules may give false negatives
- '/\w+->[^\w\d]+ \(/' => 'Space before opening bracket in function call',
- '/\w+->[^\w\d]+\( /' => 'Space before first parameter in function call',
- '/\w+->.+\ ,/' => 'Space before comma in function call',
- // Quotes added to regex to avoid "," being captured
- '/\w+->.+\,[^ \'"].+/' => 'No Space found after comma in function call',
- '/\w+->.+ \)/' => 'Space before closing parenthases in function call',
- // none capture ($foo-> or "foo" or 'foo')(nospace)(= or != or .= or =& or == or !== or === or => or ||)(nospace)
- '/(?:\$[\w->]+|[\'"].*[\'"])[^\t ](?:!?\.?=+&?|=>|\|\|)[^ ]/' => 'No spaces around assignment/logic test',
- ),
- 'end' => array(
- '/[\r\n]$/' => array('New line at end of file', 'Open and save using the Cakephp plugin to avoid this'),
- ),
- );
-
-/**
- * errors property
- *
- * @var array
- * @access public
- */
- var $errors = array();
-/**
- * execute method
- *
- * Run the main function for this task
- *
- * @return void
- * @access public
- */
- public function execute() {
- $this->out($this->inflect($this->args));
- }
-
-/**
- * help method
- *
- * @return void
- * @access public
- */
- public function help() {
- $this->out('Editor Shell Check task. Usage:');
- $this->out('cake editor check');
- $this->out(' - Check everything for code standards');
- $this->out('cake editor check <file>');
- $this->out(' - Check the file for code standards');
- $this->out('cake editor check <pattern>');
- $this->out(' - Check the files matching the pattern for code standards');
- }
-/**
- * listFiles method
- *
- * Get the list of files in the current commit
- * If called directly, find all php/ctp files, exluding a few vendors, and the webroot
- *
- * If called as part of a commit
- * if it's the first commit - check against a fictional revision to list all files
- * else check against the HEAD to get the list of files in the current commit
- *
- * @param array $args the args the script was called with
- * @return array relative path to files
- * @access public
- */
- function listFiles($args) {
- if ($args) {
- $suffix = array();
- foreach ($args as $pattern) {
- if ($pattern[0] === '*') {
- $suffix[] = '-name "' . $pattern . '"';
- }
- }
- if ($suffix) {
- $suffix = '\( ' . implode (' -o ', $suffix) . ' \)';
- } else {
- $suffix = '';
- }
- exec('find -size +1b ! -iwholename "*.svn*" ! -iwholename "*.git*" ! -iwholename "*/tmp/*" \
- ! -iwholename "*Zend*" ! -iwholename "*simpletest*" ! -iwholename "*firephp*" \
- ! -iwholename "*minify*" ! -iwholename "*jquery*" ! -iwholename "*Text*" ! -iwholename "*webroot*" \
- ' . $suffix . ' -type f', $return);
- return $return;
- }
- exec('git rev-parse --verify HEAD 2> /dev/null', $output, $return);
- if ($return) {
- $against = '4b825dc642cb6eb9a060e54bf8d69288fbee4904';
- } else {
- $against = 'HEAD';
- }
- exec("git diff-index --cached --name-only $against", $return);
- return $return;
- }
-
-/**
- * testFile method
- *
- * Get the file contents and run some basic tests
- * If it's a php file (or may include php content) run a lint test
- * Skip multiline comments (i.e. doc blocks)
- *
- * @param mixed $file
- * @param mixed $patterns
- * @param mixed $errors
- * @return void
- * @access public
- */
- function testFile($file, $patterns, &$errors) {
- $contents = file($file);
- foreach ($patterns['whole'] as $pattern => $message) {
- $string = implode($contents);
- if (!is_string($pattern) || $pattern[0] != '/') {
- if(call_user_func($pattern, $string, 0, $contents, $file)) {
- error($message, 1, $file, $errors);
- }
- } elseif (preg_match($pattern, $string)) {
- if ($pattern === '/@noverify/') {
- return;
- }
- error($message, 1, $file, $errors);
- }
- }
- foreach ($patterns['start'] as $pattern => $message) {
- if (!is_string($pattern) || $pattern[0] != '/') {
- if(call_user_func($pattern, $contents[0], 0, $contents, $file)) {
- error($message, 1, $file, $errors);
- }
- } elseif (preg_match($pattern, $contents[0])) {
- error($message, 1, $file, $errors);
- }
- }
- $startComment = '/^\s*\/\*/';
- $endComment = '/^\s*\*\//';
-
- $inAComment = false;
- foreach ($contents as $i => $line) {
- if ($inAComment) {
- if (preg_match($endComment, $line)) {
- $inAComment = false;
- }
- } elseif (preg_match($startComment, $line)) {
- $inAComment = true;
- }
- foreach ($patterns['each'] as $pattern => $message) {
- if (!$pattern && $message == 'Code') {
- if($inAComment) {
- break;
- }
- continue;
- }
- if (!is_string($pattern) || $pattern[0] != '/') {
- if(call_user_func($pattern, $line, $i, $contents, $file)) {
- error($message, $i + 1, $file, $errors);
- }
- } elseif (preg_match($pattern, $line)) {
- error($message, $i + 1, $file, $errors);
- }
- }
- }
- foreach ($patterns['end'] as $pattern => $message) {
- if (!is_string($pattern) || $pattern[0] != '/') {
- if(call_user_func($pattern, $line, $i, $contents)) {
- error($message, $i + 1, $file, $errors);
- }
- } elseif (preg_match($pattern, $line)) {
- error($message, $i + 1, $file, $errors);
- }
- }
- exec("php -l " . escapeshellarg($file), $lintOutput, $return);
- if ($return != 0) {
- foreach ($lintOutput as $error) {
- if (!empty($error[0]) && $error[0] == 'P') {
- $errors[] = $error;
- }
- }
- }
- }
-
-/**
- * error method
- *
- * Use the message as a key to prevent duplicate error messages
- *
- * @param mixed $message
- * @param mixed $line
- * @param mixed $file
- * @param mixed $errors
- * @return void
- * @access public
- */
- function error($message = null, $line = null, $file = null, &$errors = null) {
- static $vimTips = null;
- if (is_null($line)) {
- $vimTips = $message;
- }
- $vimTip = '';
- if (is_array($message)) {
- if (count($message) > 1) {
- list($message, $vimTip) = $message;
- } else {
- list($message) = $message;
- }
- }
- if ($vimTips && $vimTip) {
- $message .= ' ( ' . $vimTip . ' )';
- }
- $errors["$message in $file on line $line"] = "$message in $file on line $line";
- }
-
-/**
- * paintErrors method
- *
- * @param mixed $errors
- * @param bool $vimTips false
- * @return void
- * @access public
- */
- function paintErrors($errors, $vimTips = false) {
- $count = count($errors);
- echo implode("\n", $errors);
- echo "\n----------\n$count errors found. bypass this check with the --no-verify flag\n";
- if ($vimTips) {
- file_put_contents('errors.err', implode("\n", array_filter($errors)));
- echo "type 'vim -q errors.err' to review failures\n";
- }
- }
-
-/**
- * doubleEmpty method
- *
- * @param mixed $test
- * @param mixed $arrayIndex
- * @param mixed $contents
- * @param mixed $file
- * @return boolean
- * @access public
- */
- function doubleEmpty($test, $arrayIndex, $contents, $file) {
- if (preg_match('/^$/', $test) && isset($contents[$arrayIndex + 1]) && preg_match('/^$/', $contents[$arrayIndex + 1])) {
- if (isset($contents[$arrayIndex - 1]) && preg_match('/^$/', $contents[$arrayIndex - 1])) {
- return false; // suppress - already reported
- }
- return true;
- }
- return false;
- }
-
-/**
- * noOpenPhpTag method
- *
- * @param mixed $test
- * @param mixed $arrayIndex
- * @param mixed $contents
- * @param mixed $file
- * @return boolean
- * @access public
- */
- function noOpenPhpTag($test, $arrayIndex, $contents, $file) {
- if (!preg_match('/\.php$/', $file)) {
- return false;
- }
- if (!preg_match('/<\?php/', $test)) {
- return true;
- }
- return false;
- }
-
-/**
- * welcome method
- *
- * @TODO change visibility
- * @return void
- * @access public
- */
- public function _welcome() {
- if (!empty($this->settings['welcomeText'])) {
- parent::_welcome();
- }
- }
-}
\ No newline at end of file
diff --git a/vendors/shells/tasks/config.php b/vendors/shells/tasks/config.php
new file mode 100644
index 0000000..4cca115
--- /dev/null
+++ b/vendors/shells/tasks/config.php
@@ -0,0 +1,157 @@
+<?php
+/**
+ * COnfig task - used to view or edit a config file
+ *
+ * PHP version 5
+ *
+ * Copyright (c) 2010, Andy Dawson
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @filesource
+ * @copyright Copyright (c) 2010, Andy Dawson
+ * @link www.ad7six.com
+ * @package cakemate
+ * @subpackage cakemate.vendors.shells.tasks
+ * @since v 1.0 (14-Feb-2010)
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ */
+/**
+ * ConfigTask class
+ *
+ * @uses Shell
+ * @package cakemate
+ * @subpackage cakemate.vendors.shells.tasks
+ */
+class ConfigTask extends Shell {
+
+/**
+ * settings property
+ *
+ * @var array
+ * @access public
+ */
+ public $settings = array(
+ 'file' => null
+ );
+
+/**
+ * execute method
+ *
+ * Run the main function for this task
+ *
+ * @return void
+ * @access public
+ */
+ public function execute() {
+ if ($this->args) {
+ if (count($this->args) === 2) {
+ return $this->write($this->args[0], $this->args[1]);
+ }
+ if (count($this->args) === 1) {
+ $file = $this->file();
+ $config = array();
+ if (file_exists($file)) {
+ include($file);
+ }
+ if (isset($config[$this->args[0]])) {
+ $this->out($config[$this->args[0]]);
+ } else {
+ $this->out('Option not set');
+ }
+ return;
+ }
+ }
+ $file = $this->file();
+ $config = array();
+ if (file_exists($file)) {
+ include($file);
+ }
+ $this->out($file);
+ if ($config) {
+ foreach ($config as $key => $value) {
+ $key = str_pad($key, 20);
+ $this->out($key . ': ' . $value);
+ }
+ } else {
+ $this->out('No config');
+ }
+ }
+
+/**
+ * get or return the name of the config file to use
+ *
+ * @return the config file to use
+ * @access public
+ */
+ public function file($file = null) {
+ if ($file) {
+ $this->settings['file'] = $file;
+ return $file;
+ }
+ if (!empty($this->settings['file'])) {
+ return $this->settings['file'];
+
+ }
+
+ if (isset($this->settings['configPaths'])) {
+ $configPaths = $this->settings['configPaths'];
+ if (isset($this->settings['-global'])) {
+ $file = end($configPaths);
+ } else {
+ $file = current($configPaths);
+ }
+ } else {
+ $file = CONFIGS;
+ }
+ $file .= $this->shell . '.php';
+ $this->settings['file'] = $file;
+ return $file;
+ }
+
+/**
+ * write (or delete, if the setting is false) a config value
+ *
+ * @param mixed $key
+ * @param mixed $value null
+ * @param mixed $file null
+ * @return void
+ * @access public
+ */
+ public function write($key, $value = null, $file = null) {
+ if (!$file) {
+ $file = $this->file();
+ }
+
+ $config = array();
+ if (file_exists($file)) {
+ include($file);
+ }
+ if ($value) {
+ $config[$key] = $value;
+ } else {
+ unset($config[$key]);
+ }
+ $string = "<?php\n\$config = ";
+ $string .= var_export($config, true);
+ $string .= ';';
+ file_put_contents($file, $string);
+ }
+
+/**
+ * help method
+ *
+ * @return void
+ * @access public
+ */
+ public function help() {
+ $this->out('Config task. Usage:');
+ $this->out('cake ' . $this->shell . ' config');
+ $this->out(' - Display config settings');
+ $this->out('cake ' . $this->shell . ' config someSetting aValue');
+ $this->out(' - Set someSetting to aValue');
+ $this->out('cake ' . $this->shell . ' config someSetting aValue --global');
+ $this->out(' - Set someSetting to aValue in the global config file');
+ }
+}
\ No newline at end of file
diff --git a/vendors/shells/tasks/doc.php b/vendors/shells/tasks/doc.php
index a7aca39..ecc2e8e 100644
--- a/vendors/shells/tasks/doc.php
+++ b/vendors/shells/tasks/doc.php
@@ -34,7 +34,7 @@ class DocTask extends Shell {
* @var array
* @access public
*/
- var $tasks = array('Base');
+ public $tasks = array('Base');
/**
* regex property
diff --git a/vendors/shells/tasks/doc_file.php b/vendors/shells/tasks/doc_file.php
index 9ea0e7b..d1ffe8c 100644
--- a/vendors/shells/tasks/doc_file.php
+++ b/vendors/shells/tasks/doc_file.php
@@ -34,7 +34,7 @@ class DocFileTask extends Shell {
* @var array
* @access public
*/
- var $tasks = array('Base', 'Doc');
+ public $tasks = array('Base', 'Doc');
/**
* execute method
diff --git a/vendors/shells/tasks/doc_folder.php b/vendors/shells/tasks/doc_folder.php
index ff0ac2b..cf1dc6a 100644
--- a/vendors/shells/tasks/doc_folder.php
+++ b/vendors/shells/tasks/doc_folder.php
@@ -34,7 +34,7 @@ class DocFolderTask extends Shell {
* @var array
* @access public
*/
- var $tasks = array('Base', 'DocFile');
+ public $tasks = array('Base', 'DocFile');
/**
* execute method
diff --git a/vendors/shells/tasks/inflect.php b/vendors/shells/tasks/inflect.php
index 0c47f45..33fa1cc 100644
--- a/vendors/shells/tasks/inflect.php
+++ b/vendors/shells/tasks/inflect.php
@@ -35,7 +35,7 @@ class InflectTask extends Shell {
* @access public
*/
- var $settings = array(
+ public $settings = array(
'welcomeText' => null
);
diff --git a/vendors/shells/tasks/paths.php b/vendors/shells/tasks/paths.php
index da637d6..180232d 100644
--- a/vendors/shells/tasks/paths.php
+++ b/vendors/shells/tasks/paths.php
@@ -100,7 +100,7 @@ class PathsTask extends Shell {
* @return void
* @access public
*/
- function model($file) {
+ public function model($file) {
$class = $this->Doc->fileType($file);
$names = array();
$pluginPath = '';
diff --git a/vendors/shells/tasks/tags.php b/vendors/shells/tasks/tags.php
index b1e594c..087ab29 100644
--- a/vendors/shells/tasks/tags.php
+++ b/vendors/shells/tasks/tags.php
@@ -34,7 +34,7 @@ class TagsTask extends Shell {
* @var array
* @access public
*/
- var $tasks = array('Paths');
+ public $tasks = array('Paths');
/**
* settings property
@@ -43,7 +43,7 @@ class TagsTask extends Shell {
* @access public
*/
- var $settings = array(
+ public $settings = array(
'welcomeText' => null,
'includeTests' => false,
);
diff --git a/vendors/shells/tasks/tester.php b/vendors/shells/tasks/tester.php
index 99a651f..0e624e8 100644
--- a/vendors/shells/tasks/tester.php
+++ b/vendors/shells/tasks/tester.php
@@ -22,7 +22,7 @@ class TesterTask extends Shell {
* @return void
* @access public
*/
- function execute() {
+ public function execute() {
TestManager::runTestCase($this->case, $this->reporter);
}
@@ -35,7 +35,7 @@ class TesterTask extends Shell {
* @return void
* @access public
*/
- function startup() {
+ public function startup() {
define('TEST_CAKE_CORE_INCLUDE_PATH', CAKE_CORE_INCLUDE_PATH);
App::import('Vendor', array('Simpletest', 'Cakemate.TestManager'));
diff --git a/vendors/shells/tasks/to_controller.php b/vendors/shells/tasks/to_controller.php
index 92cdc88..ef89fc2 100644
--- a/vendors/shells/tasks/to_controller.php
+++ b/vendors/shells/tasks/to_controller.php
@@ -3,32 +3,32 @@ App::import('Core', array('File'));
class ToControllerTask extends Shell {
- var $filepath = null;
- var $directory = null;
- var $file = null;
+ public $filepath = null;
+ public $directory = null;
+ public $file = null;
- function initialize() {
+ public function initialize() {
$this->filepath = $_ENV['TM_FILEPATH'];
$this->directory = $_ENV['TM_DIRECTORY'];
$this->file =& new File($this->filepath);
}
- function execute() {
+ public function execute() {
$path = $this->_directory() . $this->_build();
$this->_open($path);
}
- function _directory($base = ROOT) {
+ protected function _directory($base = ROOT) {
return join('/', array($base, 'controllers')) . DIRECTORY_SEPARATOR;
}
- function _build() {
+ protected function _build() {
$controller = Inflector::underscore(Inflector::pluralize($this->file->name()) . 'Controller') . '.' . $this->file->ext();;
return $controller;
}
- function _open($path) {
+ protected function _open($path) {
$destination =& new File($path);
if (!$destination->exists()) {
$this->out(sprintf("The Controller %s does not seem to exist at %s. Aborting", $this->_build(), $path));
diff --git a/vendors/shells/tasks/to_model.php b/vendors/shells/tasks/to_model.php
index 92a626d..dc7c300 100644
--- a/vendors/shells/tasks/to_model.php
+++ b/vendors/shells/tasks/to_model.php
@@ -3,31 +3,31 @@ App::import('Core', array('File'));
class ToModelTask extends Shell {
- var $filepath = null;
- var $directory = null;
- var $file = null;
+ public $filepath = null;
+ public $directory = null;
+ public $file = null;
- function initialize() {
+ public function initialize() {
$this->filepath = $_ENV['TM_FILEPATH'];
$this->directory = $_ENV['TM_DIRECTORY'];
$this->file =& new File($this->filepath);
}
- function execute() {
+ public function execute() {
$path = $this->_directory() . $this->_build();
$this->_open($path);
}
- function _directory($base = ROOT) {
+ protected function _directory($base = ROOT) {
return join('/', array($base, 'models')) . DIRECTORY_SEPARATOR;
}
- function _build() {
+ protected function _build() {
$model = Inflector::singularize(str_replace('_controller', '', $this->file->name())) . '.' . $this->file->ext();
return $model;
}
- function _open($path) {
+ protected function _open($path) {
$destination =& new File($path);
if (!$destination->exists()) {
$this->out(sprintf("The Model %s does not seem to exist at %s. Aborting", $this->_build(), $path));
diff --git a/vendors/test_manager.php b/vendors/test_manager.php
index b6021f6..edec3ee 100644
--- a/vendors/test_manager.php
+++ b/vendors/test_manager.php
@@ -7,7 +7,7 @@ class TestManager {
* @return void
* @access public
*/
- function TestManager() {
+ public function TestManager() {
}
@@ -19,7 +19,7 @@ class TestManager {
* @return void
* @access public
*/
- function runTestCase($testCaseFile, &$reporter) {
+ public function runTestCase($testCaseFile, &$reporter) {
if (!file_exists($testCaseFile)) {
trigger_error("Test case {$testCaseFile} cannot be found", E_USER_ERROR);
diff --git a/views/git/class_doc.ctp b/views/git/class_doc.ctp
index 541a429..f75b19e 100644
--- a/views/git/class_doc.ctp
+++ b/views/git/class_doc.ctp
@@ -9,4 +9,4 @@
* @uses <?php echo $uses . $nl ?>
* @package <?php echo $package . $nl ?>
* @subpackage <?php echo $subPackage . $nl ?>
- */
+ */
\ No newline at end of file
diff --git a/views/git/class_file_header.ctp b/views/git/class_file_header.ctp
index f2f79fe..cb672cc 100644
--- a/views/git/class_file_header.ctp
+++ b/views/git/class_file_header.ctp
@@ -4,13 +4,13 @@
*
* PHP version 4 and 5
*
- * Copyright (c) <?php echo date('Y') ?>, <?php echo $userName . $nl?>
+ * Copyright (c) <?php echo date('Y') ?>, <?php echo $name . $nl?>
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
- * @copyright Copyright (c) <?php echo date('Y') ?>, <?php echo $userName . $nl?>
+ * @copyright Copyright (c) <?php echo date('Y') ?>, <?php echo $name . $nl?>
* @link <?php echo $website . $nl ?>
* @package <?php echo $package . $nl ?>
* @subpackage <?php echo $subPackage . $nl ?>
diff --git a/views/git/function_doc.ctp b/views/git/function_doc.ctp
index 8ec2dc9..3d1bdff 100644
--- a/views/git/function_doc.ctp
+++ b/views/git/function_doc.ctp
@@ -11,4 +11,4 @@
<?php endforeach; ?>
* @return void
* @access <?php echo $visibility . $nl ?>
- */
+ */
\ No newline at end of file
diff --git a/views/git/property_doc.ctp b/views/git/property_doc.ctp
index 28e7580..91154e1 100644
--- a/views/git/property_doc.ctp
+++ b/views/git/property_doc.ctp
@@ -3,4 +3,4 @@
*
* @var <?php echo $type . ' ' . $default . $nl ?>
* @access <?php echo $visibility . $nl ?>
- */
+ */
\ No newline at end of file
diff --git a/views/svn/class_doc.ctp b/views/svn/class_doc.ctp
index 541a429..f75b19e 100644
--- a/views/svn/class_doc.ctp
+++ b/views/svn/class_doc.ctp
@@ -9,4 +9,4 @@
* @uses <?php echo $uses . $nl ?>
* @package <?php echo $package . $nl ?>
* @subpackage <?php echo $subPackage . $nl ?>
- */
+ */
\ No newline at end of file
diff --git a/views/svn/class_file_header.ctp b/views/svn/class_file_header.ctp
index 0ab1aca..6202636 100644
--- a/views/svn/class_file_header.ctp
+++ b/views/svn/class_file_header.ctp
@@ -6,13 +6,13 @@
*
* PHP versions 4 and 5
*
- * Copyright (c) <?php echo date('Y') ?>, <?php echo $userName . $nl?>
+ * Copyright (c) <?php echo date('Y') ?>, <?php echo $name . $nl?>
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
- * @copyright Copyright (c) <?php echo date('Y') ?>, <?php echo $userName . $nl?>
+ * @copyright Copyright (c) <?php echo date('Y') ?>, <?php echo $name . $nl?>
* @link <?php echo $website . $nl ?>
* @package <?php echo $package . $nl ?>
* @subpackage <?php echo $subPackage . $nl ?>
diff --git a/views/svn/function_doc.ctp b/views/svn/function_doc.ctp
index 8ec2dc9..3d1bdff 100644
--- a/views/svn/function_doc.ctp
+++ b/views/svn/function_doc.ctp
@@ -11,4 +11,4 @@
<?php endforeach; ?>
* @return void
* @access <?php echo $visibility . $nl ?>
- */
+ */
\ No newline at end of file
diff --git a/views/svn/property_doc.ctp b/views/svn/property_doc.ctp
index 28e7580..91154e1 100644
--- a/views/svn/property_doc.ctp
+++ b/views/svn/property_doc.ctp
@@ -3,4 +3,4 @@
*
* @var <?php echo $type . ' ' . $default . $nl ?>
* @access <?php echo $visibility . $nl ?>
- */
+ */
\ No newline at end of file
