[Fusionforge-commits] r8133 - in trunk/gforge: debian plugins/scmbzr/common plugins/scmbzr/etc/plugins/scmbzr

Roland Mas lolando at libremir.placard.fr.eu.org
Mon Sep 21 22:17:45 CEST 2009


Author: lolando
Date: 2009-09-21 22:17:45 +0200 (Mon, 21 Sep 2009)
New Revision: 8133

Added:
   trunk/gforge/debian/gforge-plugin-scmbzr.init
   trunk/gforge/plugins/scmbzr/etc/plugins/scmbzr/serve-branches.conf
Modified:
   trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php
Log:
Added link and iframe for loggerhead

Added: trunk/gforge/debian/gforge-plugin-scmbzr.init
===================================================================
--- trunk/gforge/debian/gforge-plugin-scmbzr.init	                        (rev 0)
+++ trunk/gforge/debian/gforge-plugin-scmbzr.init	2009-09-21 20:17:45 UTC (rev 8133)
@@ -0,0 +1,66 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          gforge-plugin-scmbzr
+# Required-Start:    $local_fs $remote_fs $network
+# Required-Stop:     $local_fs $remote_fs $network
+# Default-Start:     2 3 4 5
+# Default-Stop:      1
+### END INIT INFO
+#
+# Init script for gforge-plugin-scmbzr Debian package.
+# Based on the script provided by loggerhead.
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DESC="Loggerhead Bazaar Branch Browser for FusionForge"
+NAME=gforge-plugin-scmbzr
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Gracefully exit if the package has been removed.
+[ -x /usr/bin/serve-branches ] || exit 0
+
+# Check if configuration file is present
+[ ! -f /etc/gforge/plugins/scmbzr/serve-branches.conf ] && exit 0
+
+. /etc/gforge/plugins/scmbzr/serve-branches.conf
+
+#
+#	Function that starts the daemon/service.
+#
+d_start() {
+    start-stop-daemon -p $PIDFILE -S --startas /usr/bin/serve-branches --chuid loggerhead --make-pidfile --background --chdir $served_branches -- --prefix=$prefix --port=$port --log-folder /var/log/loggerhead 2>/dev/null
+}
+
+#
+#	Function that stops the daemon/service.
+#
+d_stop() {
+	start-stop-daemon -p $PIDFILE -K
+}
+
+
+case "$1" in
+  start)
+	echo -n "Starting $DESC: $NAME"
+	d_start
+	echo "."
+	;;
+  stop)
+	echo -n "Stopping $DESC: $NAME"
+	d_stop
+	echo "."
+	;;
+  restart|force-reload)
+	echo -n "Restarting $DESC: $NAME"
+	d_stop
+	sleep 1
+	d_start
+	echo "."
+	;;
+  *)
+	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+	exit 1
+	;;
+esac
+
+exit 0

Modified: trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php	2009-09-21 07:19:20 UTC (rev 8132)
+++ trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php	2009-09-21 20:17:45 UTC (rev 8133)
@@ -28,6 +28,7 @@
 		$this->name = 'scmbzr';
 		$this->text = 'Bazaar';
 		$this->hooks[] = 'scm_generate_snapshots' ;
+                $this->hooks[] = 'scm_browser_page';
 
 		require_once $gfconfig.'plugins/scmbzr/config.php' ;
 		
@@ -77,13 +78,36 @@
 	}
 
 	function getBrowserLinkBlock ($project) {
-		return ;
+		global $HTML ;
+		$b = $HTML->boxMiddle(_('Bazaar Repository Browser'));
+		$b .= _('<p>Browsing the Bazaar tree gives you a view into the current status of this project\'s code. You may also view the complete histories of any file in the repository.</p>');
+		$b .= '<p>[' ;
+		$b .= util_make_link ("/scm/browser.php?group_id=".$project->getID(),
+				      _('Browse Bazaar Repository')
+			) ;
+		$b .= ']</p>' ;
+		return $b ;
 	}
 
 	function getStatsBlock ($project) {
 		return ;
 	}
 
+        function printBrowserPage ($params) {
+                global $HTML;
+
+                $project = $this->checkParams ($params) ;
+                if (!$project) {
+                        return false ;
+                }
+                
+                if ($project->usesPlugin ($this->name)) {
+                        if ($this->browserDisplayable ($project)) {
+                                print '<iframe src="'.util_make_url ("/scm/loggerhead/".$project->getUnixName()).'" frameborder="no" width=100% height=700></iframe>' ;
+                        }
+                }
+        }
+
 	function createOrUpdateRepo ($params) {
 		$project = $this->checkParams ($params) ;
 		if (!$project) {

Added: trunk/gforge/plugins/scmbzr/etc/plugins/scmbzr/serve-branches.conf
===================================================================
--- trunk/gforge/plugins/scmbzr/etc/plugins/scmbzr/serve-branches.conf	                        (rev 0)
+++ trunk/gforge/plugins/scmbzr/etc/plugins/scmbzr/serve-branches.conf	2009-09-21 20:17:45 UTC (rev 8133)
@@ -0,0 +1,3 @@
+served_branches=/var/lib/gforge/chroot/scmrepos/bzr
+prefix=plugins/scmbzr/loggerhead
+port=8081




More information about the Fusionforge-commits mailing list