Merged revisions 53150,53681,53700,53820,54200,54459 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/roa
........
r53150 | ischommer | 2008-04-22 11:12:43 +1200 (Tue, 22 Apr 2008) | 1 line
FEATURE Added a "test mode" for /db/build which allows mock-DataObject-subclasses which are just built in a test run
........
r53681 | mrickerby | 2008-04-29 15:26:52 +1200 (Tue, 29 Apr 2008) | 1 line
adding default wrapping header and footer methods, and configurable reporting to the TestRunner
........
r53700 | mrickerby | 2008-04-29 16:41:57 +1200 (Tue, 29 Apr 2008) | 1 line
FEATURE: adding support for /dev/tests --> DevelopmentAdmin-->tests() --> TestRunner, /dev/tasks --> DevelopmentAdmin-->tasks() --> TaskRunner
........
r53820 | mrickerby | 2008-04-30 19:27:52 +1200 (Wed, 30 Apr 2008) | 1 line
BUGFIX fixing up BuildTask interface and task runner action
........
r54200 | sminnee | 2008-05-09 00:28:44 +1200 (Fri, 09 May 2008) | 1 line
Added TestSession object to help with the testing of forms
........
r54459 | sminnee | 2008-05-13 17:28:25 +1200 (Tue, 13 May 2008) | 1 line
Added a basic menu of options to /dev
........
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54456 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-05-13 07:57:09 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base class for URL access to development tools. Currently supports the
|
2008-09-25 02:23:41 +02:00
|
|
|
* ; and TaskRunner.
|
Merged revisions 53150,53681,53700,53820,54200,54459 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/roa
........
r53150 | ischommer | 2008-04-22 11:12:43 +1200 (Tue, 22 Apr 2008) | 1 line
FEATURE Added a "test mode" for /db/build which allows mock-DataObject-subclasses which are just built in a test run
........
r53681 | mrickerby | 2008-04-29 15:26:52 +1200 (Tue, 29 Apr 2008) | 1 line
adding default wrapping header and footer methods, and configurable reporting to the TestRunner
........
r53700 | mrickerby | 2008-04-29 16:41:57 +1200 (Tue, 29 Apr 2008) | 1 line
FEATURE: adding support for /dev/tests --> DevelopmentAdmin-->tests() --> TestRunner, /dev/tasks --> DevelopmentAdmin-->tasks() --> TaskRunner
........
r53820 | mrickerby | 2008-04-30 19:27:52 +1200 (Wed, 30 Apr 2008) | 1 line
BUGFIX fixing up BuildTask interface and task runner action
........
r54200 | sminnee | 2008-05-09 00:28:44 +1200 (Fri, 09 May 2008) | 1 line
Added TestSession object to help with the testing of forms
........
r54459 | sminnee | 2008-05-13 17:28:25 +1200 (Tue, 13 May 2008) | 1 line
Added a basic menu of options to /dev
........
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54456 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-05-13 07:57:09 +02:00
|
|
|
*
|
|
|
|
* @todo documentation for how to add new unit tests and tasks
|
2008-06-15 15:33:53 +02:00
|
|
|
* @package sapphire
|
|
|
|
* @subpackage dev
|
Merged revisions 53150,53681,53700,53820,54200,54459 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/roa
........
r53150 | ischommer | 2008-04-22 11:12:43 +1200 (Tue, 22 Apr 2008) | 1 line
FEATURE Added a "test mode" for /db/build which allows mock-DataObject-subclasses which are just built in a test run
........
r53681 | mrickerby | 2008-04-29 15:26:52 +1200 (Tue, 29 Apr 2008) | 1 line
adding default wrapping header and footer methods, and configurable reporting to the TestRunner
........
r53700 | mrickerby | 2008-04-29 16:41:57 +1200 (Tue, 29 Apr 2008) | 1 line
FEATURE: adding support for /dev/tests --> DevelopmentAdmin-->tests() --> TestRunner, /dev/tasks --> DevelopmentAdmin-->tasks() --> TaskRunner
........
r53820 | mrickerby | 2008-04-30 19:27:52 +1200 (Wed, 30 Apr 2008) | 1 line
BUGFIX fixing up BuildTask interface and task runner action
........
r54200 | sminnee | 2008-05-09 00:28:44 +1200 (Fri, 09 May 2008) | 1 line
Added TestSession object to help with the testing of forms
........
r54459 | sminnee | 2008-05-13 17:28:25 +1200 (Tue, 13 May 2008) | 1 line
Added a basic menu of options to /dev
........
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54456 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-05-13 07:57:09 +02:00
|
|
|
*/
|
|
|
|
class DevelopmentAdmin extends Controller {
|
|
|
|
|
|
|
|
static $url_handlers = array(
|
|
|
|
'' => 'index',
|
2008-08-09 06:06:52 +02:00
|
|
|
'$Action' => '$Action',
|
|
|
|
'$Action//$Action/$ID' => 'handleAction',
|
Merged revisions 53150,53681,53700,53820,54200,54459 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/roa
........
r53150 | ischommer | 2008-04-22 11:12:43 +1200 (Tue, 22 Apr 2008) | 1 line
FEATURE Added a "test mode" for /db/build which allows mock-DataObject-subclasses which are just built in a test run
........
r53681 | mrickerby | 2008-04-29 15:26:52 +1200 (Tue, 29 Apr 2008) | 1 line
adding default wrapping header and footer methods, and configurable reporting to the TestRunner
........
r53700 | mrickerby | 2008-04-29 16:41:57 +1200 (Tue, 29 Apr 2008) | 1 line
FEATURE: adding support for /dev/tests --> DevelopmentAdmin-->tests() --> TestRunner, /dev/tasks --> DevelopmentAdmin-->tasks() --> TaskRunner
........
r53820 | mrickerby | 2008-04-30 19:27:52 +1200 (Wed, 30 Apr 2008) | 1 line
BUGFIX fixing up BuildTask interface and task runner action
........
r54200 | sminnee | 2008-05-09 00:28:44 +1200 (Fri, 09 May 2008) | 1 line
Added TestSession object to help with the testing of forms
........
r54459 | sminnee | 2008-05-13 17:28:25 +1200 (Tue, 13 May 2008) | 1 line
Added a basic menu of options to /dev
........
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54456 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-05-13 07:57:09 +02:00
|
|
|
);
|
|
|
|
|
2009-01-05 07:19:48 +01:00
|
|
|
|
|
|
|
function init() {
|
|
|
|
parent::init();
|
|
|
|
|
|
|
|
// check for valid url mapping
|
|
|
|
// lacking this information can cause really nasty bugs,
|
|
|
|
// e.g. when running Director::test() from a FunctionalTest instance
|
|
|
|
global $_FILE_TO_URL_MAPPING;
|
|
|
|
if(Director::is_cli()) {
|
|
|
|
if(isset($_FILE_TO_URL_MAPPING)) {
|
|
|
|
$fullPath = $testPath = $_SERVER['SCRIPT_FILENAME'];
|
|
|
|
while($testPath && $testPath != "/") {
|
|
|
|
$matched = false;
|
|
|
|
if(isset($_FILE_TO_URL_MAPPING[$testPath])) {
|
|
|
|
$matched = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$testPath = dirname($testPath);
|
|
|
|
}
|
|
|
|
if(!$matched) {
|
|
|
|
echo 'Warning: You probably want to define '.
|
|
|
|
'an entry in $_FILE_TO_URL_MAPPING that covers "' . Director::baseFolder() . '"' . "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo 'Warning: You probably want to define $_FILE_TO_URL_MAPPING in '.
|
|
|
|
'your _ss_environment.php as instructed on the "sake" page of the doc.silverstripe.com wiki' . "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Merged revisions 53150,53681,53700,53820,54200,54459 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/roa
........
r53150 | ischommer | 2008-04-22 11:12:43 +1200 (Tue, 22 Apr 2008) | 1 line
FEATURE Added a "test mode" for /db/build which allows mock-DataObject-subclasses which are just built in a test run
........
r53681 | mrickerby | 2008-04-29 15:26:52 +1200 (Tue, 29 Apr 2008) | 1 line
adding default wrapping header and footer methods, and configurable reporting to the TestRunner
........
r53700 | mrickerby | 2008-04-29 16:41:57 +1200 (Tue, 29 Apr 2008) | 1 line
FEATURE: adding support for /dev/tests --> DevelopmentAdmin-->tests() --> TestRunner, /dev/tasks --> DevelopmentAdmin-->tasks() --> TaskRunner
........
r53820 | mrickerby | 2008-04-30 19:27:52 +1200 (Wed, 30 Apr 2008) | 1 line
BUGFIX fixing up BuildTask interface and task runner action
........
r54200 | sminnee | 2008-05-09 00:28:44 +1200 (Fri, 09 May 2008) | 1 line
Added TestSession object to help with the testing of forms
........
r54459 | sminnee | 2008-05-13 17:28:25 +1200 (Tue, 13 May 2008) | 1 line
Added a basic menu of options to /dev
........
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54456 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-05-13 07:57:09 +02:00
|
|
|
function index() {
|
2008-09-25 02:36:20 +02:00
|
|
|
$actions = array(
|
|
|
|
"build" => "Build/rebuild this environment (formerly db/build). Call this whenever you have updated your project sources",
|
|
|
|
"tests" => "See a list of unit tests to run",
|
2008-10-02 22:59:43 +02:00
|
|
|
"tests/all" => "Run all tests",
|
2008-10-29 14:19:01 +01:00
|
|
|
"jstests" => "See a list of JavaScript tests to run",
|
|
|
|
"jstests/all" => "Run all JavaScript tests",
|
2008-10-02 22:59:43 +02:00
|
|
|
"modules/add" => "Add a module, for example, 'sake dev/modules/add ecommerce'",
|
2008-09-25 02:36:20 +02:00
|
|
|
"tasks" => "See a list of build tasks to run",
|
|
|
|
"viewcode" => "Read source code in a literate programming style",
|
|
|
|
);
|
|
|
|
|
|
|
|
// Web mode
|
|
|
|
if(!Director::is_cli()) {
|
2008-10-02 22:59:43 +02:00
|
|
|
// This action is sake-only right now.
|
|
|
|
unset($actions["modules/add"]);
|
|
|
|
|
2008-09-25 02:36:20 +02:00
|
|
|
$renderer = new DebugView();
|
|
|
|
$renderer->writeHeader();
|
|
|
|
$renderer->writeInfo("Sapphire Development Tools", Director::absoluteBaseURL());
|
|
|
|
$base = Director::baseURL();
|
|
|
|
|
|
|
|
echo '<div class="options"><ul>';
|
|
|
|
foreach($actions as $action => $description) {
|
|
|
|
echo "<li><a href=\"{$base}dev/$action\"><b>/dev/$action:</b> $description</a></li>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
$renderer->writeFooter();
|
|
|
|
|
|
|
|
// CLI mode
|
|
|
|
} else {
|
|
|
|
echo "SAPPHIRE DEVELOPMENT TOOLS\n--------------------------\n\n";
|
|
|
|
echo "You can execute any of the following commands:\n\n";
|
|
|
|
foreach($actions as $action => $description) {
|
|
|
|
echo " sake dev/$action: $description\n";
|
|
|
|
}
|
|
|
|
echo "\n\n";
|
|
|
|
}
|
Merged revisions 53150,53681,53700,53820,54200,54459 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/roa
........
r53150 | ischommer | 2008-04-22 11:12:43 +1200 (Tue, 22 Apr 2008) | 1 line
FEATURE Added a "test mode" for /db/build which allows mock-DataObject-subclasses which are just built in a test run
........
r53681 | mrickerby | 2008-04-29 15:26:52 +1200 (Tue, 29 Apr 2008) | 1 line
adding default wrapping header and footer methods, and configurable reporting to the TestRunner
........
r53700 | mrickerby | 2008-04-29 16:41:57 +1200 (Tue, 29 Apr 2008) | 1 line
FEATURE: adding support for /dev/tests --> DevelopmentAdmin-->tests() --> TestRunner, /dev/tasks --> DevelopmentAdmin-->tasks() --> TaskRunner
........
r53820 | mrickerby | 2008-04-30 19:27:52 +1200 (Wed, 30 Apr 2008) | 1 line
BUGFIX fixing up BuildTask interface and task runner action
........
r54200 | sminnee | 2008-05-09 00:28:44 +1200 (Fri, 09 May 2008) | 1 line
Added TestSession object to help with the testing of forms
........
r54459 | sminnee | 2008-05-13 17:28:25 +1200 (Tue, 13 May 2008) | 1 line
Added a basic menu of options to /dev
........
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54456 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-05-13 07:57:09 +02:00
|
|
|
}
|
|
|
|
|
2008-08-09 06:06:52 +02:00
|
|
|
function tests($request) {
|
2008-08-11 05:56:09 +02:00
|
|
|
return new TestRunner();
|
Merged revisions 53150,53681,53700,53820,54200,54459 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/roa
........
r53150 | ischommer | 2008-04-22 11:12:43 +1200 (Tue, 22 Apr 2008) | 1 line
FEATURE Added a "test mode" for /db/build which allows mock-DataObject-subclasses which are just built in a test run
........
r53681 | mrickerby | 2008-04-29 15:26:52 +1200 (Tue, 29 Apr 2008) | 1 line
adding default wrapping header and footer methods, and configurable reporting to the TestRunner
........
r53700 | mrickerby | 2008-04-29 16:41:57 +1200 (Tue, 29 Apr 2008) | 1 line
FEATURE: adding support for /dev/tests --> DevelopmentAdmin-->tests() --> TestRunner, /dev/tasks --> DevelopmentAdmin-->tasks() --> TaskRunner
........
r53820 | mrickerby | 2008-04-30 19:27:52 +1200 (Wed, 30 Apr 2008) | 1 line
BUGFIX fixing up BuildTask interface and task runner action
........
r54200 | sminnee | 2008-05-09 00:28:44 +1200 (Fri, 09 May 2008) | 1 line
Added TestSession object to help with the testing of forms
........
r54459 | sminnee | 2008-05-13 17:28:25 +1200 (Tue, 13 May 2008) | 1 line
Added a basic menu of options to /dev
........
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54456 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-05-13 07:57:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-29 14:19:01 +01:00
|
|
|
function jstests($request) {
|
|
|
|
return new JSTestRunner();
|
|
|
|
}
|
|
|
|
|
2008-08-09 06:06:52 +02:00
|
|
|
function tasks() {
|
2008-08-11 05:56:09 +02:00
|
|
|
return new TaskRunner();
|
Merged revisions 53150,53681,53700,53820,54200,54459 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/roa
........
r53150 | ischommer | 2008-04-22 11:12:43 +1200 (Tue, 22 Apr 2008) | 1 line
FEATURE Added a "test mode" for /db/build which allows mock-DataObject-subclasses which are just built in a test run
........
r53681 | mrickerby | 2008-04-29 15:26:52 +1200 (Tue, 29 Apr 2008) | 1 line
adding default wrapping header and footer methods, and configurable reporting to the TestRunner
........
r53700 | mrickerby | 2008-04-29 16:41:57 +1200 (Tue, 29 Apr 2008) | 1 line
FEATURE: adding support for /dev/tests --> DevelopmentAdmin-->tests() --> TestRunner, /dev/tasks --> DevelopmentAdmin-->tasks() --> TaskRunner
........
r53820 | mrickerby | 2008-04-30 19:27:52 +1200 (Wed, 30 Apr 2008) | 1 line
BUGFIX fixing up BuildTask interface and task runner action
........
r54200 | sminnee | 2008-05-09 00:28:44 +1200 (Fri, 09 May 2008) | 1 line
Added TestSession object to help with the testing of forms
........
r54459 | sminnee | 2008-05-13 17:28:25 +1200 (Tue, 13 May 2008) | 1 line
Added a basic menu of options to /dev
........
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54456 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-05-13 07:57:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-02 22:59:43 +02:00
|
|
|
function modules() {
|
|
|
|
return new ModuleManager();
|
|
|
|
}
|
|
|
|
|
2008-12-04 23:38:32 +01:00
|
|
|
function viewmodel() {
|
|
|
|
return new ModelViewer();
|
|
|
|
}
|
|
|
|
|
2008-09-25 02:23:41 +02:00
|
|
|
function build() {
|
|
|
|
$renderer = new DebugView();
|
|
|
|
$renderer->writeHeader();
|
2008-11-18 02:48:37 +01:00
|
|
|
$renderer->writeInfo("Environment Builder (formerly db/build)", Director::absoluteBaseURL());
|
2008-09-25 02:23:41 +02:00
|
|
|
echo "<div style=\"margin: 0 2em\">";
|
|
|
|
|
|
|
|
$da = new DatabaseAdmin();
|
|
|
|
$da->build();
|
|
|
|
|
|
|
|
echo "</div>";
|
|
|
|
$renderer->writeFooter();
|
|
|
|
}
|
|
|
|
|
2008-08-11 05:56:09 +02:00
|
|
|
function errors() {
|
|
|
|
Director::redirect("Debug_");
|
2008-08-11 01:03:35 +02:00
|
|
|
}
|
|
|
|
|
2008-08-11 05:56:09 +02:00
|
|
|
function viewcode($request) {
|
|
|
|
return new CodeViewer();
|
|
|
|
}
|
Merged revisions 53150,53681,53700,53820,54200,54459 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/roa
........
r53150 | ischommer | 2008-04-22 11:12:43 +1200 (Tue, 22 Apr 2008) | 1 line
FEATURE Added a "test mode" for /db/build which allows mock-DataObject-subclasses which are just built in a test run
........
r53681 | mrickerby | 2008-04-29 15:26:52 +1200 (Tue, 29 Apr 2008) | 1 line
adding default wrapping header and footer methods, and configurable reporting to the TestRunner
........
r53700 | mrickerby | 2008-04-29 16:41:57 +1200 (Tue, 29 Apr 2008) | 1 line
FEATURE: adding support for /dev/tests --> DevelopmentAdmin-->tests() --> TestRunner, /dev/tasks --> DevelopmentAdmin-->tasks() --> TaskRunner
........
r53820 | mrickerby | 2008-04-30 19:27:52 +1200 (Wed, 30 Apr 2008) | 1 line
BUGFIX fixing up BuildTask interface and task runner action
........
r54200 | sminnee | 2008-05-09 00:28:44 +1200 (Fri, 09 May 2008) | 1 line
Added TestSession object to help with the testing of forms
........
r54459 | sminnee | 2008-05-13 17:28:25 +1200 (Tue, 13 May 2008) | 1 line
Added a basic menu of options to /dev
........
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54456 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-05-13 07:57:09 +02:00
|
|
|
}
|
|
|
|
|
2009-02-02 00:49:53 +01:00
|
|
|
?>
|