# SINCE 0.8.0\r
groovy.scriptsFolder = groovy\r
\r
+# Specify the directory Grape uses for downloading libraries.\r
+# http://groovy.codehaus.org/Grape\r
+#\r
+# RESTART REQUIRED\r
+# SINCE 1.0.0\r
+groovy.grapeFolder = groovy/grape\r
+\r
# Scripts to execute on Pre-Receive.\r
#\r
# These scripts execute after an incoming push has been parsed and validated\r
\r
Hook contributions and improvements are welcome.\r
\r
+### Grapes\r
+\r
+*SINCE 1.0.0*\r
+\r
+[Grape](http://groovy.codehaus.org/Grape) lets you quickly add maven repository dependencies to your Groovy hook script. \r
+\r
+<blockquote>Grape (The Groovy Adaptable Packaging Engine or Groovy Advanced Packaging Engine) is the infrastructure enabling the grab() calls in Groovy, a set of classes leveraging [Ivy](http://ant.apache.org/ivy) to allow for a repository driven module system for Groovy. This allows a developer to write a script with an essentially arbitrary library requirement, and ship just the script. Grape will, at runtime, download as needed and link the named libraries and all dependencies forming a transitive closure when the script is run from existing repositories such as Ibiblio, Codehaus, and java.net.</blockquote>\r
+\r
+%BEGINCODE%\r
+// create and use a primitive array\r
+import org.apache.commons.collections.primitives.ArrayIntList\r
+\r
+@Grab(group='commons-primitives', module='commons-primitives', version='1.0')\r
+def createEmptyInts() { new ArrayIntList() }\r
+\r
+def ints = createEmptyInts()\r
+ints.add(0, 42)\r
+assert ints.size() == 1\r
+assert ints.get(0) == 42\r
+%ENDCODE%\r
+\r
### Custom Fields\r
\r
*SINCE 1.0.0*\r
**New:** *git.packedGitMmap = false* \r
- Added default access restriction. Applies to new repositories and repositories that have not been configured with Gitblit. (issue 88) \r
**New:** *git.defaultAccessRestriction = NONE* \r
+- Added setting to control Groovy Grape root folder. [Grape](http://groovy.codehaus.org/Grape) allows you to add Maven dependencies to your pre-/post-receive hook script classpath. \r
+ **New:** *groovy.grapeFolder = groovy/grape* \r
- Added LDAP User Service with many new *realm.ldap* keys (Github/jcrygier)\r
- Added support for custom repository properties for Groovy hooks (Github/jcrygier)\r
- Added script to facilitate proxy environment setup on Linux (Github/mragab)\r
public void init(ServletConfig config) throws ServletException {\r
groovyDir = GitBlit.getGroovyScriptsFolder();\r
try {\r
- gse = new GroovyScriptEngine(groovyDir.getAbsolutePath());\r
+ // set Grape root\r
+ File grapeRoot = new File(GitBlit.getString(Keys.groovy.grapeFolder, "groovy/grape")).getAbsoluteFile();\r
+ grapeRoot.mkdirs();\r
+ System.setProperty("grape.root", grapeRoot.getAbsolutePath());\r
+ \r
+ gse = new GroovyScriptEngine(groovyDir.getAbsolutePath()); \r
} catch (IOException e) {\r
throw new ServletException("Failed to instantiate Groovy Script Engine!", e);\r
}\r