+++ /dev/null
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides: @OLDPACKAGE@-plugin-scmbzr
-# Required-Start: $local_fs $remote_fs $network
-# Required-Stop: $local_fs $remote_fs $network
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-### END INIT INFO
-#
-# Init script for @OLDPACKAGE@-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 @FORGENAME@"
-NAME=@OLDPACKAGE@-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/@OLDPACKAGE@/plugins/scmbzr/serve-branches.conf ] && exit 0
-
-. /etc/@OLDPACKAGE@/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
--- /dev/null
+<IfModule wsgi_module>
+ WSGIDaemonProcess fusionforge-plugin-scmbzr user=gforge group=gforge processes=4 maximum-requests=1000 display-name=fusionforge-plugin-scmbzr
+</IfModule>
-<Proxy http://127.0.0.1:8081/*>
- Allow from all
-</Proxy>
+Alias {core/url_prefix}scm/loggerhead/static /usr/share/loggerhead/static
+RewriteEngine On
+RewriteRule ^{core/url_prefix}scm/loggerhead$ {core/url_prefix}scm/loggerhead/ [R]
-<Location {core/url_prefix}scm/loggerhead/>
- ProxyPass http://127.0.0.1:8081/
- ProxyPassReverse http://127.0.0.1:8081/
+WSGIScriptAlias {core/url_prefix}scm/loggerhead /usr/bin/loggerhead.wsgi
+
+<Location {core/url_prefix}scm/loggerhead>
+ WSGIProcessGroup fusionforge-plugin-scmbzr
+ Order deny,allow
+ Allow from all
</Location>
--- /dev/null
+#! /bin/sh
+#
+# Configure Loggerhead for FusionForge
+# Roland Mas
+
+set -e
+
+if [ `id -u` != 0 ] ; then
+ echo "You must be root to run this, please enter passwd"
+ exec su -c "$0 $1"
+fi
+
+configfile=~gforge/.bazaar/bazaar.conf
+cachedir=/var/cache/gforge/loggerhead
+
+case "$1" in
+ configure)
+ PATH=/usr/share/gforge/bin:/usr/share/fusionforge/bin:$PATH
+ repos_path=$(forge_get_config repos_path scmbzr)
+ web_host=$(forge_get_config web_host)
+ url_prefix=$(forge_get_config url_prefix)
+
+ a2enmod wsgi
+ if [ ! -e $configfile ] ; then
+ mkdir -p $(dirname $configfile)
+ cat > $configfile <<EOF
+# Directory to serve bzr branches from
+# Non-bzr directories under this path will also be visible in loggerhead
+http_root_dir = '${repos_path}'
+
+# The url prefix for the bzr branches.
+http_user_prefix = 'http://${web_host}${url_prefix}scm/loggerhead'
+
+# Directory to put cache files in
+http_sql_dir = '/var/cache/gforge/loggerhead'
+EOF
+ mkdir -p $cachedir
+ chown gforge $cachedir
+ fi
+ ;;
+
+ purge)
+ rm -rf $configfile $cachedir
+ rmdir $(dirname $configfile) || true
+ ;;
+
+ *)
+ echo "Usage: $0 {configure|purge}"
+ exit 1
+esac
Package: @PACKAGE@-plugin-scmbzr
Architecture: all
-Depends: @OLDPACKAGE@-common, @OLDPACKAGE@-db-postgresql | @OLDPACKAGE@-db, @OLDPACKAGE@-web-apache2 | @OLDPACKAGE@-web, @OLDPACKAGE@-shell-postgresql | @OLDPACKAGE@-shell, bzr, php5-cli, ${misc:Depends}
+Depends: @OLDPACKAGE@-common, @OLDPACKAGE@-db-postgresql | @OLDPACKAGE@-db, @OLDPACKAGE@-web-apache2 | @OLDPACKAGE@-web, @OLDPACKAGE@-shell-postgresql | @OLDPACKAGE@-shell, bzr, php5-cli, ${misc:Depends}, libapache2-mod-wsgi, loggerhead (>= 1.19~bzr477~), python-pastedeploy
Provides: @PACKAGE@-plugin-scm, @OLDPACKAGE@-plugin-scmbzr
Conflicts: @OLDPACKAGE@-plugin-scmbzr
Replaces: @OLDPACKAGE@-plugin-scmbzr
+plugins/scmbzr/bin/* usr/share/gforge/scmbzr/bin/
plugins/scmbzr/common/* usr/share/gforge/plugins/scmbzr/common/
plugins/scmbzr/etc/plugins/scmbzr/* etc/gforge/plugins/scmbzr/
plugins/scmbzr/etc/*.ini etc/@PACKAGE@/config.ini.d/
$suite->addTestFiles(glob("func/Forums/*Test.php"));
$suite->addTestFiles(glob("func/News/*Test.php"));
$suite->addTestFiles(glob("func/PluginsBlocks/*Test.php"));
+ $suite->addTestFiles(glob("func/PluginsScmBzr/*Test.php"));
$suite->addTestFiles(glob("func/PluginsScmGit/*Test.php"));
$suite->addTestFiles(glob("func/RBAC/*Test.php"));
$suite->addTestFiles(glob("func/Surveys/*Test.php"));
$suite->addTestFiles(glob("func/PluginsMediawiki/*Test.php"));
$suite->addTestFiles(glob("func/PluginsMoinMoin/*Test.php"));
$suite->addTestFiles(glob("func/PluginsOnlineHelp/*Test.php"));
+ $suite->addTestFiles(glob("func/PluginsScmBzr/*Test.php"));
$suite->addTestFiles(glob("func/PluginsScmGit/*Test.php"));
// $suite->addTestFiles(glob("func/PluginsSvnTracker/*Test.php"));
$suite->addTestFiles(glob("func/RBAC/*Test.php"));
// $suite->addTestFiles(glob("func/PluginsMediawiki/*Test.php"));
// $suite->addTestFiles(glob("func/PluginsMoinMoin/*Test.php"));
$suite->addTestFiles(glob("func/PluginsOnlineHelp/*Test.php"));
+// $suite->addTestFiles(glob("func/PluginsScmBzr/*Test.php"));
// $suite->addTestFiles(glob("func/PluginsScmGit/*Test.php"));
// $suite->addTestFiles(glob("func/PluginsSvnTracker/*Test.php"));
$suite->addTestFiles(glob("func/RBAC/*Test.php"));
// $suite->addTestFiles(glob("func/PluginsMediawiki/*Test.php"));
// $suite->addTestFiles(glob("func/PluginsMoinMoin/*Test.php"));
$suite->addTestFiles(glob("func/PluginsOnlineHelp/*Test.php"));
+// $suite->addTestFiles(glob("func/PluginsScmBzr/*Test.php"));
// $suite->addTestFiles(glob("func/PluginsScmGit/*Test.php"));
// $suite->addTestFiles(glob("func/PluginsSvnTracker/*Test.php"));
$suite->addTestFiles(glob("func/RBAC/*Test.php"));
--- /dev/null
+<?php
+/*
+ * Copyright (C) 2012 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+require_once dirname(dirname(__FILE__)).'/Testing/SeleniumGforge.php';
+
+class ScmBzrTest extends FForge_SeleniumTestCase
+{
+ function testScmBzr()
+ {
+ $this->activatePlugin('scmbzr');
+ $this->populateStandardTemplate('empty');
+ $this->init();
+
+ $this->open(ROOT);
+ $this->clickAndWait("link=ProjectA");
+ $this->clickAndWait("link=Admin");
+ $this->clickAndWait("link=Tools");
+ $this->clickAndWait("link=Source Code Admin");
+ $this->click("//input[@name='scmradio' and @value='scmbzr']");
+ $this->clickAndWait("submit");
+
+ // Run the cronjob to create repositories
+ $this->cron("create_scm_repos.php");
+
+ // Check that the repo is present and Loggerhead shows it (even if empty)
+ $this->open(ROOT);
+ $this->clickAndWait("link=ProjectA");
+ $this->clickAndWait("link=SCM");
+
+ $this->open(ROOT.'/scm/loggerhead/');
+ $this->assertTextPresent("Browsing (root)");
+ $this->clickAndWait("link=projecta");
+ $this->assertTextPresent("Browsing (root)/projecta");
+
+ // Get the address of the repo
+ $this->open(ROOT);
+ $this->clickAndWait("link=ProjectA");
+ $this->clickAndWait("link=SCM");
+ $p = $this->getText("//tt[contains(.,'bzr checkout bzr+ssh')]");
+ $p = preg_replace(",^bzr checkout ,", "", $p);
+ $p = preg_replace(",://.*@,", "://root@", $p);
+ $p = preg_replace(",/branchname$,", "", $p);
+
+ // Create a local branch, push it to the repo
+ $t = exec("mktemp -d /tmp/bzrTest.XXXXXX");
+ system("cd $t && bzr init --quiet trunk >/dev/null", $ret);
+ $this->assertEquals($ret, 0);
+
+ system("echo 'this is a simple text' > $t/trunk/mytext.txt");
+ system("cd $t/trunk && bzr add --quiet && bzr commit -m'Adding file' --quiet", $ret);
+ system("echo 'another simple text' >> $t/trunk/mytext.txt");
+ system("cd $t/trunk && bzr add --quiet && bzr commit -m'Modifying file' --quiet", $ret);
+ $this->assertEquals($ret, 0);
+
+ system("cd $t/trunk && bzr push --quiet $p/trunk", $ret);
+ $this->assertEquals($ret, 0);
+
+ $this->open(ROOT.'/scm/loggerhead/projecta');
+ $this->assertTextPresent("Browsing (root)/projecta");
+ $this->assertTextPresent("trunk");
+ $this->clickAndWait("link=trunk");
+ $this->assertTextPresent("Modifying file");
+ $this->assertTextNotPresent("Adding file");
+ $this->clickAndWait("link=Changes");
+ $this->assertTextPresent("Modifying file");
+ $this->assertTextPresent("Adding file");
+
+ system("rm -fr $t");
+ }
+}
+?>