Merge branch 'master' of bitbucket.org:colosa/processmaker

This commit is contained in:
Victor Saisa Lopez
2014-01-21 14:21:38 -04:00
2 changed files with 89 additions and 37 deletions

View File

@@ -1,6 +1,15 @@
#!/usr/bin/env php
<?php
/*
* Script o build vendors that requires make some builds and copy some files to a determined path
*
* @license Colosa Inc.
* @author Erik Amaru Ortiz
*/
define('DS', DIRECTORY_SEPARATOR);
// --no-ansi wins over --ansi
if (in_array('--no-ansi', $argv)) {
define('USE_ANSI', false);
@@ -31,24 +40,23 @@ $projects = array(
);
echo PHP_EOL;
out(" *** Building js projects ***", 'info', true);
out("Building JS Projects ", 'info');
out("--------------------", 'info');
foreach ($projects as $project) {
echo PHP_EOL;
for($i=0; $i<40; $i++) echo '-';
echo PHP_EOL;
out(" Building: $project ", 'success', true);
for($i=0; $i<40; $i++) echo '-';
echo PHP_EOL.PHP_EOL;
out("=> Building project: ", 'info', false);
echo $project.' '.PHP_EOL;
chdir($vendorDir.DS.$project);
echo `rake`;
echo `rake`;
out("Completed!", 'success');
}
echo PHP_EOL;
out(" *** Compying project files to its destination ***", 'info', true);
out("Copying project files to its destination", 'info', true);
out("----------------------------------------", 'info', true);
$destinationDir = dirname(__FILE__) . DS . 'workflow/public_html/lib';
@@ -97,58 +105,103 @@ $filesCollection = array(
"colosa/pmui/libraries/jquery-ui/js/jquery-ui-1.10.3.custom.min.js" => "js/jquery-ui-1.10.3.custom.min.js",
"colosa/pmui/libraries/dataTables/js/jquery.dataTables.min.js" => "js/jquery.dataTables.min.js",
"colosa/pmui/build/js/min/pmui-1.0.0.min.js" => "pmUI/pmui-1.0.0.js",
array(
"try_files" => array("colosa/pmui/build/js/min/pmui-1.0.0.min.js", "colosa/pmui/build/js/pmui-1.0.0.js"),
"to_file" => "pmUI/pmui-1.0.0.js"
),
"colosa/pmui/build/css/pmui-1.0.0.css" => "pmUI/pmui-1.0.0.css",
"colosa/pmui/build/img/*" => "img/",
);
echo "Destination dir: $destinationDir" . PHP_EOL.PHP_EOL;
out("* Destination dir: ", 'info', false);
echo $destinationDir . PHP_EOL.PHP_EOL;
$successCount = 0;
foreach ($filesCollection as $source => $target) {
out("Copy: ", 'info', false);
echo "$source $target" . PHP_EOL;
echo `cp -Rf $vendorDir/$source $destinationDir/$target`;
if (! is_array($target)) {
if (strpos($source, '*') !== false) {
out("Create dir: ", 'info', false);
echo $target;
out(" from source: ", 'info', false);
echo $source;
out(" [DONE]", "success", true) . PHP_EOL;
echo `cp -Rf $vendorDir/$source $destinationDir/$target`;
$successCount++;
} else {
out("Create file: ", 'info', false);
echo $target;
out(" from source: ", 'info', false);
echo $source;
if (file_exists("$vendorDir/$source")) {
out(" [DONE]", "success", true) . PHP_EOL;
echo `cp -Rf $vendorDir/$source $destinationDir/$target`;
$successCount++;
} else {
out(" [FAILED]", "error", true) . PHP_EOL;
}
}
} else {
out("Create file: ", 'info', false);
echo $target['to_file'];
out(" from source: ", 'info', false);
$sw = true;
$files = $target['try_files'];
$target = $target['to_file'];
foreach ($files as $file) {
if (file_exists("$vendorDir/$file")) {
echo $file;
out(" [DONE]", "success", true) . PHP_EOL;
echo `cp -Rf $vendorDir/$file $destinationDir/$target`;
$successCount++;
$sw = false;
break;
}
}
if ($sw) {
echo '('.implode(', ', $target['try_files']).')';
out(" [FAILED]", "error", true) . PHP_EOL;
}
}
}
$n = count($filesCollection);
echo PHP_EOL;
echo sprintf("- Finished, Copied [%s/%s] files.", $successCount, $n).PHP_EOL;
if ($successCount == count($filesCollection)) {
out(sprintf("- All files copied successfully!", $successCount, $n), "success", true);
} else {
out("- Finished but with errors while copying!", "error", true);
}
echo PHP_EOL;
/////////////////////
/**
* colorize output
*/
function out($text, $color = null, $newLine = true)
{
$styles = array(
'success' => "\033[0;32m%s\033[0m",
'error' => "\033[31;31m%s\033[0m",
'info' => "\033[33;33m%s\033[0m"
'success' => "\033[0;35;32m%s\033[0m",
'error' => "\033[0;35;31m%s\033[0m",
'info' => "\033[1;33;34m%s\033[0m"
);
$format = '%s';
if (isset($styles[$color]) && USE_ANSI) {
if (isset($styles[$color])) {
$format = $styles[$color];
}

View File

@@ -41,7 +41,7 @@ Feature: Output Documents Negative Tests
Examples:
| test_description | project | out_doc_title | out_doc_description |out_doc_filename | out_doc_template | out_doc_report_generator | out_doc_landscape | out_doc_media | out_doc_left_margin | out_doc_right_margin | out_doc_top_margin | out_doc_bottom_margin | out_doc_generate | out_doc_type | out_doc_current_revision | out_doc_field_mapping | out_doc_versioning | out_doc_destination_path | out_doc_tags | out_doc_pdf_security_enabled | out_doc_pdf_security_open_password | out_doc_pdf_security_owner_password | out_doc_pdf_security_permissions | error_code | error_message |
| Invalid PDF Generator | 4224292655297723eb98691001100052 | Endpoint New Version 4 | Output Document new version - EndPoint | Output 5 | | @#$%¼¤¾½ | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | | | 400 | out_doc_report_generator |
| Invalid PDF Generator | 4224292655297723eb98691001100052 | Endpoint New Version 4 | Output Document new version - EndPoint | Output 5 | | @#$%¼¤¾½ | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | | | 400 | out_doc_report_generator |
| Invalid landscape | 4224292655297723eb98691001100052 | Endpoint New Version PDF SECURIT5 | Output Document new version PDF SECURITY | Output 6 | | TCPDF | 34 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 0 | | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | 400 | out_doc_landscape |
| Invalid media type | 4224292655297723eb98691001100052 | Endpoint New Version Doc6 | Output Document new version solo doc | Output 7 | | TCPDF | 0 | Legal!@#$$$%^&| 25 | 25 | 25 | 25 | WORD | HTML | 0 | | 1 | | | 0 | | | | 400 | out_doc_media |
| Invalid document type | 4224292655297723eb98691001100052 | Endpoint New Version PDF7 | Output Document new version solo pdf | Output 8 | | TCPDF | 0 | Legal | 25,56.98 | 25 | 25 | 25 | PDF | HTML | 0 | | 1 | | | 1 | sample | sample | print | 400 | out_doc_left_margin |
@@ -56,5 +56,4 @@ Feature: Output Documents Negative Tests
| Field requered out doc title | 4224292655297723eb98691001100052 | | Output Document old version - EndPoint | Output 22 | | HTML2PDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | | | 400 | out_doc_title |
| Field required out doc filename | 4224292655297723eb98691001100052 | Endpoint Old Version Doc | Output Document old version solo doc | | | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | WORD | HTML | 0 | | 1 | | | 0 | | | | 400 | out_doc_generate |
| Output created with same name | 4224292655297723eb98691001100052 | Endpoint Old Version (base) | Output Document old version solo doc | Output 23 | | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 0 | | 1 | | | 0 | | | | 400 | Output Document with the same name in this process |