Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 85 lines (75 sloc) 2.059 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
#!/usr/bin/php
<?php
namespace Maiden;
$timeZone = @date_default_timezone_get();

if (!$timeZone) {
$timeZone = "UTC";
}
date_default_timezone_set($timeZone);

$path = realpath(dirname(__FILE__));
ini_set("include_path", ".:{$path}:{$path}/lib:{$path}/modules/Piton/lib:" . PEAR_INSTALL_DIR);

require "Piton/Application/AutoLoader.php";
\Piton\Application\AutoLoader::register("{$path}/modules/Piton/lib/");
\Piton\Application\AutoLoader::register("{$path}/lib/");

$maidenRunner = new MaidenRunner($logger = new \Piton\Log\DefaultLogger());

$options = array();

// Commandline options
$options = array(
"-b" => array(
"description" => "Show a bare list of targets",
"action" => function($args) use ($maidenRunner) {
$maidenRunner->listTargets();
return false;
},
),
"-l" => array(
"description" => "Show list of targets with descriptions",
"action" => function($args) use ($maidenRunner) {
$maidenRunner->listTargetDescriptions();
return false;
},
),
"-q" => array(
"description" => "Run target and supress output",
"action" => function($args) use ($maidenRunner, $logger) {
$logger->setLevel($logger::LEVEL_WARNING);
},
),
"-v" => array(
"description" => "Run target with verbose output",
"action" => function($args) use ($maidenRunner, $logger) {
$logger->setLevel($logger::LEVEL_DEBUG);
},
),
"-h" => array(
"description" => "Displays this usages",
"action" => function($args, $options) {
echo "\n\tMaiden a PHP build tool by Paul Serby\n\n";
foreach ($options as $option => $optionData) {
echo "\t$option\t{$optionData["description"]}\n";
}
echo "\n";
return false;
}
)
);

array_shift($argv);

if (count($argv) == 0) {
$argv[] = "-l";
}

$arguments = array();
foreach ($argv as $arg) {
if (!isset($target) && isset($options[$arg])) {
if ($options[$arg]["action"]($argv, $options) === false) {
exit;
}
} else {
if (isset($target)) {
$arguments[] = $arg;
} else {
$target = $arg;
}
}
}
// Run the chosen target
$maidenRunner->run($target, $arguments);
Something went wrong with that request. Please try again.