Files
luos/build-vendor.php

88 lines
1.8 KiB
PHP
Raw Normal View History

2014-01-21 12:56:43 -04:00
#!/usr/bin/env php
2013-11-22 16:20:49 -04:00
<?php
2014-01-21 12:56:43 -04:00
/*
* Script o build vendors that requires make some builds and copy some files to a determined path
*
* @license Colosa Inc.
* @author Erik Amaru Ortiz
*/
$config = @parse_ini_file("workflow/engine/config/env.ini");
$debug = !empty($config) && isset($config['debug']) ? $config['debug'] : 0;
2013-11-22 16:20:49 -04:00
define('DS', DIRECTORY_SEPARATOR);
2014-01-21 12:56:43 -04:00
2013-11-22 16:20:49 -04:00
// --no-ansi wins over --ansi
if (in_array('--no-ansi', $argv)) {
define('USE_ANSI', false);
} elseif (in_array('--ansi', $argv)) {
define('USE_ANSI', true);
} else {
// On Windows, default to no ANSI, except in ANSICON and ConEmu.
// Everywhere else, default to ANSI if stdout is a terminal.
define('USE_ANSI',
2014-01-24 11:33:25 -04:00
(DIRECTORY_SEPARATOR == '\\')
? (false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'))
: (function_exists('posix_isatty') && posix_isatty(1))
2013-11-22 16:20:49 -04:00
);
}
$vendorDir = dirname(__FILE__) . DS . 'vendor';
if (! is_dir($vendorDir )) {
echo "Vendor directory is missing!" . PHP_EOL;
exit();
}
$projects = array(
'colosa/MichelangeloFE',
'colosa/pmUI'
2013-11-22 16:20:49 -04:00
);
foreach ($projects as $project) {
echo PHP_EOL;
2014-01-21 12:56:43 -04:00
out("=> Building project: ", 'info', false);
echo $project.' '.PHP_EOL;
2013-11-22 16:20:49 -04:00
chdir($vendorDir.DS.$project);
if ($debug)
echo `rake pmBuildDebug`;
else
echo `rake pmBuild`;
2014-01-21 12:56:43 -04:00
out("Completed!", 'success');
2013-11-22 16:20:49 -04:00
}
echo PHP_EOL;
/////////////////////
2014-01-21 12:56:43 -04:00
2013-11-22 16:20:49 -04:00
/**
* colorize output
*/
function out($text, $color = null, $newLine = true)
{
$styles = array(
2014-01-21 12:56:43 -04:00
'success' => "\033[0;35;32m%s\033[0m",
'error' => "\033[0;35;31m%s\033[0m",
'info' => "\033[1;33;34m%s\033[0m"
2013-11-22 16:20:49 -04:00
);
$format = '%s';
2014-01-21 12:56:43 -04:00
if (isset($styles[$color])) {
2013-11-22 16:20:49 -04:00
$format = $styles[$color];
}
if ($newLine) {
$format .= PHP_EOL;
}
printf($format, $text);
}