ScriptBindingInitializer (Grails 2.4.4)
Date: 2014-10-28

Package: org.codehaus.groovy.grails.cli.support

## [Java] Class ScriptBindingInitializer

- org.codehaus.groovy.grails.cli.support.ScriptBindingInitializer

- Configures the binding used when running Grails scripts.

  Authors:
    Graeme Rocher
  Since:
    2.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static java.lang.String` | `ARGS_MAP` |
    `static java.lang.String` | `BASEDIR` |
    `static java.lang.String` | `BASE_FILE` |
    `static java.lang.String` | `BASE_NAME` |
    `static java.lang.String` | `GRAILS_CONSOLE` |
    `static java.lang.String` | `GRAILS_ENV` |
    `static java.lang.String` | `GRAILS_HOME` |
    `static java.lang.String` | `GRAILS_SCRIPT` |
    `static java.lang.String` | `GRAILS_SETTINGS` |
    `static java.lang.String` | `GRAILS_VERSION` |
    `static java.lang.String` | `SCAFFOLD_DIR` |
    `static java.lang.String` | `USER_HOME` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `ScriptBindingInitializer (CommandLine commandLine, java.net.URLClassLoader classLoader, BuildSettings settings, PluginPathDiscoverySupport pluginPathSupport, boolean interactive)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `org.codehaus.gant.GantBinding` | `initBinding(org.codehaus.gant.GantBinding binding, java.lang.String scriptName)` Prep the binding.
    `static BaseSettingsApi` | `initBinding(groovy.lang.Binding binding, BuildSettings buildSettings, java.net.URLClassLoader classLoader, GrailsConsole grailsConsole, boolean interactive)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Field Detail

    - #### public static final java.lang.String ARGS_MAP

    - #### public static final java.lang.String BASEDIR

    - #### public static final java.lang.String BASE_FILE

    - #### public static final java.lang.String BASE_NAME

    - #### public static final java.lang.String GRAILS_CONSOLE

    - #### public static final java.lang.String GRAILS_ENV

    - #### public static final java.lang.String GRAILS_HOME

    - #### public static final java.lang.String GRAILS_SCRIPT

    - #### public static final java.lang.String GRAILS_SETTINGS

    - #### public static final java.lang.String GRAILS_VERSION

    - #### public static final java.lang.String SCAFFOLD_DIR

    - #### public static final java.lang.String USER_HOME

  - ### Constructor Detail

    - #### public ScriptBindingInitializer(CommandLine commandLine, java.net.URLClassLoader classLoader, BuildSettings settings, PluginPathDiscoverySupport pluginPathSupport, boolean interactive)

  - ### Method Detail

    - #### @java.lang.SuppressWarnings("unchecked") public org.codehaus.gant.GantBinding initBinding(org.codehaus.gant.GantBinding binding, java.lang.String scriptName)

      Prep the binding. We add the location of GRAILS_HOME under the variable name "grailsHome". We also add a closure that should be used with "includeTargets <<" - it takes a string and returns either a file containing the named Grails script or the script class. So, this: includeTargets << grailsScript("Init") will load the "Init" script from $GRAILS_HOME/scripts if it exists there; otherwise it will load the Init class.

    - #### public static BaseSettingsApi initBinding(groovy.lang.Binding binding, BuildSettings buildSettings, java.net.URLClassLoader classLoader, GrailsConsole grailsConsole, boolean interactive)