From e36d4de3a9dc55359f3b54dbf06adc8209d1028c Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 06 Jan 2012 17:20:59 -0500
Subject: [PATCH] WAR/Express builds now copy bundled push scripts to configured scripts folder

---
 src/com/gitblit/GitBlit.java |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java
index d712056..ce3e16d 100644
--- a/src/com/gitblit/GitBlit.java
+++ b/src/com/gitblit/GitBlit.java
@@ -452,7 +452,7 @@
 		List<String> names = new ArrayList<String>(userService.getAllUsernames());
 		return names;
 	}
-	
+
 	/**
 	 * Returns the list of all users available to the login service.
 	 * 
@@ -546,7 +546,7 @@
 		List<String> teams = new ArrayList<String>(userService.getAllTeamNames());
 		return teams;
 	}
-	
+
 	/**
 	 * Returns the list of available teams that a user or repository may be
 	 * assigned to.
@@ -1788,6 +1788,21 @@
 				webxmlSettings.applyOverrides(overrideFile);
 			}
 			configureContext(webxmlSettings, true);
+
+			// Copy the included scripts to the configured groovy folder
+			File localScripts = getFileOrFolder(Keys.groovy.scriptsFolder, "groovy");
+			if (!localScripts.exists()) {
+				File includedScripts = new File(context.getRealPath("/WEB-INF/groovy"));
+				if (!includedScripts.equals(localScripts)) {
+					try {
+						com.gitblit.utils.FileUtils.copy(localScripts, includedScripts.listFiles());
+					} catch (IOException e) {
+						logger.error(MessageFormat.format(
+								"Failed to copy included Groovy scripts from {0} to {1}",
+								includedScripts, localScripts));
+					}
+				}
+			}
 		}
 
 		serverStatus.servletContainer = servletContext.getServerInfo();

--
Gitblit v1.9.1