Skip to content

Commit

Permalink
10:19 up 12 days, 17:45, 2 users, load averages: 1,26 1,41 1,32
Browse files Browse the repository at this point in the history
USER     TTY      FROM              LOGIN@  IDLE WHAT
peg      console  -                27Dic12 12days -
peg      s000     -                10:16       - w
  • Loading branch information
marcopeg committed Jan 9, 2013
2 parents a785ded + e369222 commit 311ccac
Show file tree
Hide file tree
Showing 137 changed files with 2,163 additions and 845 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
@@ -0,0 +1,13 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org

root = true

[*]
indent_style = tab
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.bat]
end_of_line = crlf
15 changes: 14 additions & 1 deletion .travis.yml
Expand Up @@ -10,6 +10,16 @@ env:
- DB=pgsql
- DB=sqlite

matrix:
allow_failures:
- php: 5.4
env:
- PHPCS=1
include:
- php: 5.4
env:
- PHPCS=1

before_script:
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test2;'; fi"
Expand All @@ -23,6 +33,9 @@ before_script:
server.listen(80, 'localhost');
console.log('TCP server listening on port 80 at localhost.');" > app/tmp/socket.js
- sudo node ./app/tmp/socket.js &
- pear channel-discover pear.cakephp.org
- pear install --alldeps cakephp/CakePHP_CodeSniffer
- phpenv rehash
- set +H
- echo "<?php
class DATABASE_CONFIG {
Expand Down Expand Up @@ -105,7 +118,7 @@ before_script:
}" > app/Config/database.php

script:
- ./lib/Cake/Console/cake test core AllTests --stderr
- sh -c "if [ '$PHPCS' != '1' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; else phpcs --extensions=php --standard=CakePHP ./lib/Cake; fi"

notifications:
email: false
5 changes: 4 additions & 1 deletion app/Config/Schema/i18n.php
Expand Up @@ -19,14 +19,17 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

// @codingStandardsIgnoreStart

/*
*
* Using the Schema command line utility
* cake schema run create i18n
*
*/
class i18nSchema extends CakeSchema {

// @codingStandardsIgnoreEnd

public $name = 'i18n';

public function before($event = array()) {
Expand Down
4 changes: 3 additions & 1 deletion app/Config/core.php
Expand Up @@ -42,7 +42,8 @@
* Options:
*
* - `handler` - callback - The callback to handle errors. You can set this to any callable type,
* including anonymous functions.
* including anonymous functions.
* Make sure you add App::uses('MyHandler', 'Error'); when using a custom handler class
* - `level` - int - The level of errors you are interested in capturing.
* - `trace` - boolean - Include stack traces for errors in log files.
*
Expand All @@ -64,6 +65,7 @@
*
* - `handler` - callback - The callback to handle exceptions. You can set this to any callback type,
* including anonymous functions.
* Make sure you add App::uses('MyHandler', 'Error'); when using a custom handler class
* - `renderer` - string - The class responsible for rendering uncaught exceptions. If you choose a custom class you
* should place the file for that class in app/Lib/Error. This class needs to implement a render method.
* - `log` - boolean - Should Exceptions be logged?
Expand Down
42 changes: 39 additions & 3 deletions build.xml
Expand Up @@ -40,6 +40,9 @@
<include name="cake" />
</fileset>

<fileset id="non-tests" dir="./lib/Cake">
<exclude name=".lib/Cake/Test" />
</fileset>

<!-- start fresh each time. Remove the dist and build dirs -->
<target name="clean">
Expand Down Expand Up @@ -197,18 +200,51 @@
<!--
Upload to pirum pear channel.
-->
<target name="distribute" depends="prepare">
<target name="distribute" depends="prepare" description="Upload pear packages to pear.cakephp.org">
<echo msg="Uploading tgz file to cakephp.org" />
<exec command="scp ${dist.dir}/${pear.package}.tgz cakephp@cakephp.org:${pirum.dir}" dir="." checkreturn="true" />

<echo msg="Adding new release to pirum" />
<exec command="ssh cakephp@cakephp.org pirum add ${pirum.dir} ${pirum.dir}/${pear.package}.tgz" checkreturn="true" />
</target>

<target name="codestyle" description="Check codestyle (human readable format)">
<phpcodesniffer
standard="CakePHP"
allowedFileExtensions="php">
<fileset refid="libs" />
</phpcodesniffer>
</target>

<target name="reports-ci">
<phpcodesniffer
standard="CakePHP"
allowedFileExtensions="php">
<fileset refid="libs" />
<formatter type="checkstyle" outfile="checkstyle.xml" />
</phpcodesniffer>
<phpcpd
minLines="4"
minTokens="50">
<fileset refid="libs" />
<formatter type="pmd" outfile="pmd-cpd.xml"/>
</phpcpd>
<phpdepend>
<fileset refid="non-tests" />
<logger type="jdepend-xml" outfile="jdepend.xml"/>
</phpdepend>
<phpmd rulesets="codesize,unusedcode,design">
<fileset refid="non-tests" />
<formatter type="xml" outfile="reports/pmd.html"/>
</phpmd>
</target>

<!--
Top level easy to type targets
-->
<target name="build" depends="generate-package" />
<target name="release" depends="release-commit,build,distribute" />
<target name="build" depends="generate-package" description="Generate a pear package" />
<target name="release" depends="release-commit,build,distribute" description="Release a new version of CakePHP" />
<target name="code-reports" depends="reports-ci"
description="Run the code reports, generating XML output for CI server use." />

</project>
10 changes: 10 additions & 0 deletions lib/Cake/Console/Command/ConsoleShell.php
Expand Up @@ -238,7 +238,9 @@ public function main($command = null) {

if ($this->_isValidModel($modelToCheck)) {
$findCommand = "\$data = \$this->$command;";
//@codingStandardsIgnoreStart
@eval($findCommand);
//@codingStandardsIgnoreEnd

if (is_array($data)) {
foreach ($data as $idx => $results) {
Expand Down Expand Up @@ -294,7 +296,9 @@ public function main($command = null) {
list($foo, $data) = explode("->save", $command);
$data = preg_replace('/^\(*(array)?\(*(.+?)\)*$/i', '\\2', $data);
$saveCommand = "\$this->{$modelToSave}->save(array('{$modelToSave}' => array({$data})));";
//@codingStandardsIgnoreStart
@eval($saveCommand);
//@codingStandardsIgnoreEnd
$this->out(__d('cake_console', 'Saved record for %s', $modelToSave));
}
break;
Expand All @@ -304,7 +308,9 @@ public function main($command = null) {
if ($this->_isValidModel($modelToCheck)) {
// Get the column info for this model
$fieldsCommand = "\$data = \$this->{$modelToCheck}->getColumnTypes();";
//@codingStandardsIgnoreStart
@eval($fieldsCommand);
//@codingStandardsIgnoreEnd

if (is_array($data)) {
foreach ($data as $field => $type) {
Expand All @@ -326,7 +332,9 @@ public function main($command = null) {
$this->out(print_r(Hash::combine(Router::$routes, '{n}.template', '{n}.defaults'), true));
break;
case (preg_match("/^route\s+(\(.*\))$/i", $command, $tmp) == true):
//@codingStandardsIgnoreStart
if ($url = eval('return array' . $tmp[1] . ';')) {
//@codingStandardsIgnoreEnd
$this->out(Router::url($url));
}
break;
Expand Down Expand Up @@ -362,7 +370,9 @@ protected function _loadRoutes() {
Router::reload();
extract(Router::getNamedExpressions());

//@codingStandardsIgnoreStart
if (!@include APP . 'Config' . DS . 'routes.php') {
//@codingStandardsIgnoreEnd
return false;
}
CakePlugin::routes();
Expand Down
1 change: 0 additions & 1 deletion lib/Cake/Console/Command/Task/TemplateTask.php
Expand Up @@ -78,7 +78,6 @@ protected function _findThemes() {

$paths[] = $core;

// TEMPORARY TODO remove when all paths are DS terminated
foreach ($paths as $i => $path) {
$paths[$i] = rtrim($path, DS) . DS;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Console/Command/TestShell.php
Expand Up @@ -114,7 +114,7 @@ public function getOptionParser() {
))->addOption('stop-on-failure', array(
'help' => __d('cake_console', 'Stop execution upon first failure.'),
'boolean' => true
))->addOption('stop-on-skipped ', array(
))->addOption('stop-on-skipped', array(
'help' => __d('cake_console', 'Stop execution upon first skipped test.'),
'boolean' => true
))->addOption('stop-on-incomplete', array(
Expand All @@ -132,7 +132,7 @@ public function getOptionParser() {
))->addOption('no-globals-backup', array(
'help' => __d('cake_console', 'Do not backup and restore $GLOBALS for each test.'),
'boolean' => true
))->addOption('static-backup ', array(
))->addOption('static-backup', array(
'help' => __d('cake_console', 'Backup and restore static attributes for each test.'),
'boolean' => true
))->addOption('syntax-check', array(
Expand Down
8 changes: 5 additions & 3 deletions lib/Cake/Console/ConsoleOptionParser.php
Expand Up @@ -345,6 +345,7 @@ public function addArgument($name, $params = array()) {
$arg = new ConsoleInputArgument($options);
}
$this->_args[$index] = $arg;
ksort($this->_args);
return $this;
}

Expand Down Expand Up @@ -584,7 +585,8 @@ protected function _parseOption($name, $params) {
$option = $this->_options[$name];
$isBoolean = $option->isBoolean();
$nextValue = $this->_nextToken();
if (!$isBoolean && !empty($nextValue) && !$this->_optionExists($nextValue)) {
$emptyNextValue = (empty($nextValue) && $nextValue !== '0');
if (!$isBoolean && !$emptyNextValue && !$this->_optionExists($nextValue)) {
array_shift($this->_tokens);
$value = $nextValue;
} elseif ($isBoolean) {
Expand Down Expand Up @@ -625,7 +627,7 @@ protected function _optionExists($name) {
*/
protected function _parseArg($argument, $args) {
if (empty($this->_args)) {
array_push($args, $argument);
$args[] = $argument;
return $args;
}
$next = count($args);
Expand All @@ -634,7 +636,7 @@ protected function _parseArg($argument, $args) {
}

if ($this->_args[$next]->validChoice($argument)) {
array_push($args, $argument);
$args[] = $argument;
return $args;
}
}
Expand Down
6 changes: 5 additions & 1 deletion lib/Cake/Console/Shell.php
Expand Up @@ -372,7 +372,9 @@ public function runCommand($command, $argv) {
if (!empty($this->params['quiet'])) {
$this->_useLogger(false);
}

if (!empty($this->params['plugin'])) {
CakePlugin::load($this->params['plugin']);
}
$this->command = $command;
if (!empty($this->params['help'])) {
return $this->_displayHelp($command);
Expand Down Expand Up @@ -686,7 +688,9 @@ public function createFile($path, $contents) {
protected function _checkUnitTest() {
if (class_exists('PHPUnit_Framework_TestCase')) {
return true;
//@codingStandardsIgnoreStart
} elseif (@include 'PHPUnit' . DS . 'Autoload.php') {
//@codingStandardsIgnoreEnd
return true;
} elseif (App::import('Vendor', 'phpunit', array('file' => 'PHPUnit' . DS . 'Autoload.php'))) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/ShellDispatcher.php
Expand Up @@ -215,7 +215,7 @@ public function dispatch() {
return $Shell->main();
}
}

throw new MissingShellMethodException(array('shell' => $shell, 'method' => $command));
}

Expand Down
5 changes: 4 additions & 1 deletion lib/Cake/Console/Templates/skel/Config/Schema/i18n.php
Expand Up @@ -21,14 +21,17 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

// @codingStandardsIgnoreStart

/*
*
* Using the Schema command line utility
* cake schema run create i18n
*
*/
class i18nSchema extends CakeSchema {

// @codingStandardsIgnoreEnd

public $name = 'i18n';

public function before($event = array()) {
Expand Down
4 changes: 3 additions & 1 deletion lib/Cake/Console/Templates/skel/Config/core.php
Expand Up @@ -42,7 +42,8 @@
* Options:
*
* - `handler` - callback - The callback to handle errors. You can set this to any callable type,
* including anonymous functions.
* including anonymous functions.
* Make sure you add App::uses('MyHandler', 'Error'); when using a custom handler class
* - `level` - int - The level of errors you are interested in capturing.
* - `trace` - boolean - Include stack traces for errors in log files.
*
Expand All @@ -64,6 +65,7 @@
*
* - `handler` - callback - The callback to handle exceptions. You can set this to any callback type,
* including anonymous functions.
* Make sure you add App::uses('MyHandler', 'Error'); when using a custom handler class
* - `renderer` - string - The class responsible for rendering uncaught exceptions. If you choose a custom class you
* should place the file for that class in app/Lib/Error. This class needs to implement a render method.
* - `log` - boolean - Should Exceptions be logged?
Expand Down
12 changes: 7 additions & 5 deletions lib/Cake/Controller/CakeErrorController.php
Expand Up @@ -19,6 +19,8 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

App::uses('AppController', 'Controller');

/**
* Error Handling Controller
*
Expand Down Expand Up @@ -50,18 +52,18 @@ class CakeErrorController extends AppController {
*/
public function __construct($request = null, $response = null) {
parent::__construct($request, $response);
if (count(Router::extensions())) {
$this->components[] = 'RequestHandler';
}
$this->constructClasses();
if (count(Router::extensions()) &&
!$this->Components->attached('RequestHandler')
) {
$this->RequestHandler = $this->Components->load('RequestHandler');
}
if ($this->Components->enabled('Auth')) {
$this->Components->disable('Auth');
}
if ($this->Components->enabled('Security')) {
$this->Components->disable('Security');
}
$this->startupProcess();

$this->_set(array('cacheAction' => false, 'viewPath' => 'Errors'));
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Controller/Component/Acl/AclInterface.php
Expand Up @@ -8,7 +8,7 @@
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.Controller.Component
* @package Cake.Controller.Component.Acl
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand All @@ -17,7 +17,7 @@
* Access Control List interface.
* Implementing classes are used by AclComponent to perform ACL checks in Cake.
*
* @package Cake.Controller.Component
* @package Cake.Controller.Component.Acl
*/
interface AclInterface {

Expand Down

0 comments on commit 311ccac

Please sign in to comment.