[Fusionforge-commits] r14727 - trunk/src/utils

Alain Peyrat aljeux at fusionforge.org
Wed Oct 26 15:53:27 CEST 2011


Author: aljeux
Date: 2011-10-26 15:53:26 +0200 (Wed, 26 Oct 2011)
New Revision: 14727

Added:
   trunk/src/utils/forge.php
Log:
Simple CLI for forge operations, to be completed

Added: trunk/src/utils/forge.php
===================================================================
--- trunk/src/utils/forge.php	                        (rev 0)
+++ trunk/src/utils/forge.php	2011-10-26 13:53:26 UTC (rev 14727)
@@ -0,0 +1,63 @@
+#! /usr/bin/php -f
+<?php
+/**
+ * FusionForge source control management
+ *
+ * Copyright 2009, Roland Mas
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ * 
+ * FusionForge is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+        
+require (dirname(__FILE__).'/../common/include/env.inc.php');
+require_once $gfcommon.'include/pre.php';
+
+class Actions {
+	function help ($name='') {
+		$methods = join('|', get_class_methods($this));
+		echo "Usage: forge.php ($methods) [arguments...]\n" ;
+		exit (1) ;
+	}
+
+	function pluginActivate ($name) {
+		$pm = plugin_manager_get_object();
+		$pm->activate($name);
+		$pm->LoadPlugin($name);
+		$plugin = $pm->GetPluginObject($name);
+		$plugin->install();
+	}
+	
+	function pluginDeactivate ($name) {
+		$pm = plugin_manager_get_object();
+		$pm->deactivate($name);
+	}
+}
+
+if (count($argv) == 3) {
+	$action = $argv[1];
+	$name   = $argv[2];
+} else {
+	$action = 'help';
+	$name   = '';
+}
+	
+$ctl = new Actions();
+if (!method_exists($ctl, $action)) {
+	$action = 'help';
+}
+
+$ctl->$action($name);




More information about the Fusionforge-commits mailing list