This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  3b3f5956b00da07b900288e777e087768cdc2d5d (commit)
      from  4b2b7d1d687883102a9abea3f6765f87067771b0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=3b3f5956b00da07b900288e777e087768cdc2d5d

commit 3b3f5956b00da07b900288e777e087768cdc2d5d
Author: Franck Villaume <[email protected]>
Date:   Wed Mar 1 20:53:40 2017 +0100

    forge cli: implement artifactDump

diff --git a/src/bin/forge b/src/bin/forge
index 68680ce..8c0da7b 100755
--- a/src/bin/forge
+++ b/src/bin/forge
@@ -44,6 +44,20 @@ class CliActions {
                                echo "Use: .../forge pluginDeactivate 
<pluginName>\n";
                                echo "to deactivate the <pluginName> plugin\n";
                                break;
+                       case 'artifactDump':
+                               echo "Use: .../forge artifactDump <aid> 
[latest|all] [json|raw]\n";
+                               echo "to dump an artifact from a specific 
tracker of a project.\n";
+                               echo "the following functions are available:\n";
+                               echo " - latest: (default option)\n";
+                               echo "   use it to dump the latest value of the 
artifact\n";
+                               echo " - all:\n";
+                               echo "   use it to dump the full history and 
latest value of the artifact\n";
+                               echo "the following output formats are 
available:\n";
+                               echo " - json:\n";
+                               echo "   pretty json formated string output\n";
+                               echo " - raw: (default)\n";
+                               echo "   standard PHP array print_r format\n";
+                               break;
                        case 'trackerDump':
                                echo "Use: .../forge trackerDump <atid> 
[setup|data|all] [json|raw]\n";
                                echo "to dump a tracker from a specific 
project.\n";
@@ -111,6 +125,42 @@ class CliActions {
                $pm->deactivate($name);
        }
 
+       function artifactDump($aid, $params = array('latest', 'json', 'print')) 
{
+               $artifactDump = array();
+               $artf = artifact_get_object($aid);
+               if ($artf && is_object($artf) && !$artf->isError()) {
+                       switch ($params[0]) {
+                               case 'all':
+                                       $artifactDump['history'] = 
$artf->getHistory();
+                               case 'latest':
+                                       $artifactDump['artifact'] = 
(array)$artf;
+                                       $artifactDump['monitor'] = 
$artf->getMonitorIds();
+                                       $artifactDump['messages'] = array();
+                                       $messages = $artf->getMessages();
+                                       if (db_numrows($messages) > 0) {
+                                               while ($arr = 
db_fetch_array($messages)) {
+                                                       
$artifactDump['messages'] = $arr;
+                                               }
+                                       }
+                                       $artifactDump['files'] = 
$artf->getFiles();
+                                       $artifactDump['tasks'] = array();
+                                       $tasks = $artf->getRelatedTasks();
+                                       if (db_numrows($tasks) > 0) {
+                                               while ($arr = 
db_fetch_array($tasks)) {
+                                                       
$artifactDump['tasks'][] = $arr;
+                                               }
+                                       }
+                                       break;
+                               default:
+                                       $artifactDump['error'][] = _('Unknown 
function');
+                                       break;
+                       }
+               } else {
+                       $artifactDump['error'][] = _('Unable to get artifact 
id')._(': ').$aid;
+               }
+               $this->print_result($artifactDump, $params);
+       }
+
        function groupDump($group_id, $params = array('setup', 'json', 
'print')) {
                $groupDump = array();
                $group = group_get_object($group_id);

-----------------------------------------------------------------------

Summary of changes:
 src/bin/forge | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to