mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-07 20:12:42 +00:00
Adding console dir to skel.
Updating project task to test for directories and files in a more readable way.
This commit is contained in:
parent
52d958d1ca
commit
53a1663b96
7 changed files with 129 additions and 41 deletions
|
@ -154,6 +154,7 @@ class ProjectTask extends Shell {
|
||||||
if (!empty($this->params['empty'])) {
|
if (!empty($this->params['empty'])) {
|
||||||
$skip = array();
|
$skip = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Folder->copy(array('to' => $path, 'skip' => $skip))) {
|
if ($Folder->copy(array('to' => $path, 'skip' => $skip))) {
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(sprintf(__('<success>Created:</success> %s in %s'), $app, $path));
|
$this->out(sprintf(__('<success>Created:</success> %s in %s'), $app, $path));
|
||||||
|
@ -348,6 +349,8 @@ class ProjectTask extends Shell {
|
||||||
__('Generate a new CakePHP project skeleton.')
|
__('Generate a new CakePHP project skeleton.')
|
||||||
)->addArgument('name', array(
|
)->addArgument('name', array(
|
||||||
'help' => __('Application directory to make, if it starts with "/" the path is absolute.')
|
'help' => __('Application directory to make, if it starts with "/" the path is absolute.')
|
||||||
|
))->addOption('empty', array(
|
||||||
|
'help' => __('Create empty files in each of the directories. Good if you are using git')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
26
cake/console/templates/skel/console/cake
Normal file
26
cake/console/templates/skel/console/cake
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash
|
||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
# Bake is a shell script for running CakePHP bake script
|
||||||
|
# PHP 5
|
||||||
|
#
|
||||||
|
# CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
# Copyright 2005-2010, Cake Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under The MIT License
|
||||||
|
# Redistributions of files must retain the above copyright notice.
|
||||||
|
#
|
||||||
|
# @copyright Copyright 2005-2010, Cake Software Foundation, Inc.
|
||||||
|
# @link http://cakephp.org CakePHP(tm) Project
|
||||||
|
# @package cake
|
||||||
|
# @subpackage cake.app.console
|
||||||
|
# @since CakePHP(tm) v 2.0
|
||||||
|
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
LIB=${0/%cake/}
|
||||||
|
APP=`pwd`
|
||||||
|
|
||||||
|
exec php -q ${LIB}cake.php -working "${APP}" "$@"
|
||||||
|
|
||||||
|
exit;
|
33
cake/console/templates/skel/console/cake.bat
Normal file
33
cake/console/templates/skel/console/cake.bat
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
::
|
||||||
|
:: Bake is a shell script for running CakePHP bake script
|
||||||
|
:: PHP 5
|
||||||
|
::
|
||||||
|
:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
:: Copyright 2005-2010, Cake Software Foundation, Inc.
|
||||||
|
::
|
||||||
|
:: Licensed under The MIT License
|
||||||
|
:: Redistributions of files must retain the above copyright notice.
|
||||||
|
::
|
||||||
|
:: @copyright Copyright 2005-2010, Cake Software Foundation, Inc.
|
||||||
|
:: @link http://cakephp.org CakePHP(tm) Project
|
||||||
|
:: @package cake
|
||||||
|
:: @subpackage cake.app.console
|
||||||
|
:: @since CakePHP(tm) v 2.0
|
||||||
|
:: @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
|
::
|
||||||
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
|
||||||
|
:: In order for this script to work as intended, the cake\console\ folder must be in your PATH
|
||||||
|
|
||||||
|
@echo.
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
SET app=%0
|
||||||
|
SET lib=%~dp0
|
||||||
|
|
||||||
|
php -q "%lib%cake.php" -working "%CD%" %*
|
||||||
|
|
||||||
|
echo.
|
||||||
|
|
||||||
|
exit /B %ERRORLEVEL%
|
25
cake/console/templates/skel/console/cake.php
Normal file
25
cake/console/templates/skel/console/cake.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/php -q
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Command-line code generation utility to automate programmer chores.
|
||||||
|
*
|
||||||
|
* Shell dispatcher class
|
||||||
|
*
|
||||||
|
* PHP 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
* Copyright 2005-2010, Cake Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
* @link http://cakephp.org CakePHP(tm) Project
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.cake.console
|
||||||
|
* @since CakePHP(tm) v 1.2.0.5012
|
||||||
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
|
*/
|
||||||
|
require_once(__APP_PATH__ . 'shell_dispatcher.php');
|
||||||
|
|
||||||
|
ShellDispatcher::run($argv);
|
|
@ -84,18 +84,32 @@ class ProjectTaskTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testBake() {
|
public function testBake() {
|
||||||
$this->_setupTestProject();
|
$this->_setupTestProject();
|
||||||
|
|
||||||
$path = $this->Task->path . 'bake_test_app';
|
$path = $this->Task->path . 'bake_test_app';
|
||||||
|
|
||||||
$this->assertTrue(is_dir($path), 'No project dir %s');
|
$this->assertTrue(is_dir($path), 'No project dir %s');
|
||||||
$this->assertTrue(is_dir($path . DS . 'controllers'), 'No controllers dir %s');
|
$dirs = array(
|
||||||
$this->assertTrue(is_dir($path . DS . 'controllers' . DS .'components'), 'No components dir %s');
|
'config',
|
||||||
$this->assertTrue(is_dir($path . DS . 'models'), 'No models dir %s');
|
'config' . DS . 'schema',
|
||||||
$this->assertTrue(is_dir($path . DS . 'views'), 'No views dir %s');
|
'console',
|
||||||
$this->assertTrue(is_dir($path . DS . 'views' . DS . 'helpers'), 'No helpers dir %s');
|
'console' . DS . 'shells',
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests'), 'No tests dir %s');
|
'console' . DS . 'shells' . DS . 'tasks',
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'cases'), 'No cases dir %s');
|
'controllers',
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'groups'), 'No groups dir %s');
|
'models',
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'fixtures'), 'No fixtures dir %s');
|
'views',
|
||||||
|
'views' . DS . 'helpers',
|
||||||
|
'tests',
|
||||||
|
'tests' . DS . 'cases',
|
||||||
|
'tests' . DS . 'cases' . DS . 'models',
|
||||||
|
'tests' . DS . 'cases',
|
||||||
|
'tests' . DS . 'fixtures',
|
||||||
|
'tmp',
|
||||||
|
'webroot',
|
||||||
|
'webroot' . DS . 'js',
|
||||||
|
'webroot' . DS . 'css',
|
||||||
|
);
|
||||||
|
foreach ($dirs as $dir) {
|
||||||
|
$this->assertTrue(is_dir($path . DS . $dir), 'Missing ' . $dir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,36 +121,24 @@ class ProjectTaskTest extends CakeTestCase {
|
||||||
$this->Task->params['empty'] = true;
|
$this->Task->params['empty'] = true;
|
||||||
$this->_setupTestProject();
|
$this->_setupTestProject();
|
||||||
$path = $this->Task->path . 'bake_test_app';
|
$path = $this->Task->path . 'bake_test_app';
|
||||||
$this->assertTrue(is_dir($path), 'No project dir %s');
|
|
||||||
$this->assertTrue(is_dir($path . DS . 'controllers'), 'No controllers dir %s');
|
$empty = array(
|
||||||
$this->assertTrue(is_dir($path . DS . 'controllers' . DS .'components'), 'No components dir %s');
|
'console' . DS . 'shells' . DS . 'tasks',
|
||||||
$this->assertTrue(is_dir($path . DS . 'models'), 'No models dir %s');
|
'controllers' . DS . 'components',
|
||||||
$this->assertTrue(is_dir($path . DS . 'views'), 'No views dir %s');
|
'models' . DS . 'behaviors',
|
||||||
$this->assertTrue(is_dir($path . DS . 'views' . DS . 'helpers'), 'No helpers dir %s');
|
'views' . DS . 'helpers',
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests'), 'No tests dir %s');
|
'views' . DS . 'errors',
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'cases'), 'No cases dir %s');
|
'views' . DS . 'scaffolds',
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'groups'), 'No groups dir %s');
|
'tests' . DS . 'cases' . DS . 'models',
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'fixtures'), 'No fixtures dir %s');
|
'tests' . DS . 'cases' . DS . 'controllers',
|
||||||
|
'tests' . DS . 'cases' . DS . 'helpers',
|
||||||
$this->assertTrue(is_file($path . DS . 'controllers' . DS .'components' . DS . 'empty'), 'No empty file in dir %s');
|
'tests' . DS . 'fixtures',
|
||||||
$this->assertTrue(is_file($path . DS . 'locale' . DS . 'eng' . DS . 'LC_MESSAGES' . DS . 'empty'), 'No empty file in dir %s');
|
'webroot' . DS . 'js'
|
||||||
$this->assertTrue(is_file($path . DS . 'models' . DS . 'behaviors' . DS . 'empty'), 'No empty file in dir %s');
|
);
|
||||||
$this->assertTrue(is_file($path . DS . 'models' . DS . 'datasources' . DS . 'empty'), 'No empty file in dir %s');
|
|
||||||
$this->assertTrue(is_file($path . DS . 'plugins' . DS . 'empty'), 'No empty file in dir %s');
|
foreach ($empty as $dir) {
|
||||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'behaviors' . DS . 'empty'), 'No empty file in dir %s');
|
$this->assertTrue(is_file($path . DS . $dir . DS . 'empty'), 'Missing empty file in ' . $dir);
|
||||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'components' . DS . 'empty'), 'No empty file in dir %s');
|
}
|
||||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'controllers' . DS . 'empty'), 'No empty file in dir %s');
|
|
||||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'datasources' . DS . 'empty'), 'No empty file in dir %s');
|
|
||||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'helpers' . DS . 'empty'), 'No empty file in dir %s');
|
|
||||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'models' . DS . 'empty'), 'No empty file in dir %s');
|
|
||||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'shells' . DS . 'empty'), 'No empty file in dir %s');
|
|
||||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'fixtures' . DS . 'empty'), 'No empty file in dir %s');
|
|
||||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'groups' . DS . 'empty'), 'No empty file in dir %s');
|
|
||||||
$this->assertTrue(is_file($path . DS . 'vendors' . DS . 'shells' . DS . 'tasks' . DS . 'empty'), 'No empty file in dir %s');
|
|
||||||
$this->assertTrue(is_file($path . DS . 'views' . DS . 'errors' . DS . 'empty'), 'No empty file in dir %s');
|
|
||||||
$this->assertTrue(is_file($path . DS . 'views' . DS . 'helpers' . DS . 'empty'), 'No empty file in dir %s');
|
|
||||||
$this->assertTrue(is_file($path . DS . 'views' . DS . 'scaffolds' . DS . 'empty'), 'No empty file in dir %s');
|
|
||||||
$this->assertTrue(is_file($path . DS . 'webroot' . DS . 'js' . DS . 'empty'), 'No empty file in dir %s');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -272,7 +274,6 @@ class ProjectTaskTest extends CakeTestCase {
|
||||||
$this->assertTrue(is_dir($path . DS . 'views' . DS . 'helpers'), 'No helpers dir %s');
|
$this->assertTrue(is_dir($path . DS . 'views' . DS . 'helpers'), 'No helpers dir %s');
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests'), 'No tests dir %s');
|
$this->assertTrue(is_dir($path . DS . 'tests'), 'No tests dir %s');
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'cases'), 'No cases dir %s');
|
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'cases'), 'No cases dir %s');
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'groups'), 'No groups dir %s');
|
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'fixtures'), 'No fixtures dir %s');
|
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'fixtures'), 'No fixtures dir %s');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue