James Moger
2012-06-18 67d4f89b0cddb3de05c20e08c20f1bea714c2a9e
Added setting to control Groovy Grape folder (issue-91)
4 files modified
37 ■■■■■ changed files
distrib/gitblit.properties 7 ●●●●● patch | view | raw | blame | history
docs/01_setup.mkd 21 ●●●●● patch | view | raw | blame | history
docs/04_releases.mkd 2 ●●●●● patch | view | raw | blame | history
src/com/gitblit/GitServlet.java 7 ●●●● patch | view | raw | blame | history
distrib/gitblit.properties
@@ -151,6 +151,13 @@
# SINCE 0.8.0
groovy.scriptsFolder = groovy
# Specify the directory Grape uses for downloading libraries.
# http://groovy.codehaus.org/Grape
#
# RESTART REQUIRED
# SINCE 1.0.0
groovy.grapeFolder = groovy/grape
# Scripts to execute on Pre-Receive.
#
# These scripts execute after an incoming push has been parsed and validated
docs/01_setup.mkd
@@ -398,6 +398,27 @@
Hook contributions and improvements are welcome.
### Grapes
*SINCE 1.0.0*
[Grape](http://groovy.codehaus.org/Grape) lets you quickly add maven repository dependencies to your Groovy hook script.
<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>
%BEGINCODE%
// create and use a primitive array
import org.apache.commons.collections.primitives.ArrayIntList
@Grab(group='commons-primitives', module='commons-primitives', version='1.0')
def createEmptyInts() { new ArrayIntList() }
def ints = createEmptyInts()
ints.add(0, 42)
assert ints.size() == 1
assert ints.get(0) == 42
%ENDCODE%
### Custom Fields
*SINCE 1.0.0*
docs/04_releases.mkd
@@ -35,6 +35,8 @@
    **New:** *git.packedGitMmap = false*  
- Added default access restriction.  Applies to new repositories and repositories that have not been configured with Gitblit. (issue 88)  
    **New:** *git.defaultAccessRestriction = NONE*  
- 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.
    **New:** *groovy.grapeFolder = groovy/grape*
- Added LDAP User Service with many new *realm.ldap* keys (Github/jcrygier)
- Added support for custom repository properties for Groovy hooks (Github/jcrygier)
- Added script to facilitate proxy environment setup on Linux (Github/mragab)
src/com/gitblit/GitServlet.java
@@ -79,7 +79,12 @@
    public void init(ServletConfig config) throws ServletException {
        groovyDir = GitBlit.getGroovyScriptsFolder();
        try {
            gse = new GroovyScriptEngine(groovyDir.getAbsolutePath());
            // set Grape root
            File grapeRoot = new File(GitBlit.getString(Keys.groovy.grapeFolder, "groovy/grape")).getAbsoluteFile();
            grapeRoot.mkdirs();
            System.setProperty("grape.root", grapeRoot.getAbsolutePath());
            gse = new GroovyScriptEngine(groovyDir.getAbsolutePath());
        } catch (IOException e) {
            throw new ServletException("Failed to instantiate Groovy Script Engine!", e);
        }