ENHANCEMENT: Better CLI output of 'sake dev'

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63025 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-09-25 00:36:20 +00:00
parent 92946e4ae7
commit f47d5481ee
1 changed files with 30 additions and 15 deletions

View File

@ -17,21 +17,36 @@ class DevelopmentAdmin extends Controller {
);
function index() {
$renderer = new DebugView();
$renderer->writeHeader();
$renderer->writeInfo("Sapphire Development Tools", Director::absoluteBaseURL());
$base = Director::baseURL();
echo <<<HTML
<div class="options">
<ul>
<li style="margin-bottom: 1em"><a href="{$base}dev/build"><b>/dev/build:</b> Build/rebuild this environment (formerly db/build). Call this whenever you have updated your project sources</a></li>
<li><a href="{$base}dev/tests"><b>/dev/tests:</b> See a list of unit tests to run</a></li>
<li><a href="{$base}dev/tasks"><b>/dev/tasks:</b> See a list of build tasks to run</a></li>
<li><a href="{$base}dev/viewcode"><b>/dev/viewcode:</b> Read source code in a literate programming style</a></li>
</ul>
</div>
HTML;
$renderer->writeFooter();
$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",
"tasks" => "See a list of build tasks to run",
"viewcode" => "Read source code in a literate programming style",
);
// Web mode
if(!Director::is_cli()) {
$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";
}
}
function tests($request) {