Search in sources :

Example 6 with ConfigSlurper

use of groovy.util.ConfigSlurper in project grails-core by grails.

the class AbstractGrailsPluginManager method getConfigSlurper.

static ConfigSlurper getConfigSlurper(GrailsApplication application) {
    String environment = Environment.getCurrent().getName();
    ConfigSlurper configSlurper = new ConfigSlurper(environment);
    final Map<String, Object> binding = new HashMap<>();
    // configure config slurper binding
    binding.put(CONFIG_BINDING_USER_HOME, System.getProperty("user.home"));
    binding.put(CONFIG_BINDING_GRAILS_HOME, System.getProperty("grails.home"));
    if (application != null) {
        binding.put(CONFIG_BINDING_APP_NAME, application.getMetadata().getApplicationName());
        binding.put(CONFIG_BINDING_APP_VERSION, application.getMetadata().getApplicationVersion());
        binding.put(GrailsApplication.APPLICATION_ID, application);
    }
    configSlurper.setBinding(binding);
    return configSlurper;
}
Also used : HashMap(java.util.HashMap) ConfigObject(groovy.util.ConfigObject) ConfigSlurper(groovy.util.ConfigSlurper)

Aggregations

ConfigSlurper (groovy.util.ConfigSlurper)6 ConfigObject (groovy.util.ConfigObject)5 HashMap (java.util.HashMap)2 PropertySourcesConfig (org.grails.config.PropertySourcesConfig)2 MockApplicationContext (org.grails.support.MockApplicationContext)2 Decorator (com.opensymphony.module.sitemesh.Decorator)1 Page (com.opensymphony.module.sitemesh.Page)1 HTMLPageParser (com.opensymphony.module.sitemesh.parser.HTMLPageParser)1 Enhanced (grails.artefact.Enhanced)1 Config (grails.config.Config)1 DefaultGrailsApplication (grails.core.DefaultGrailsApplication)1 GrailsPlugin (grails.plugins.GrailsPlugin)1 PluginException (grails.plugins.exceptions.PluginException)1 ExpandoMetaClass (groovy.lang.ExpandoMetaClass)1 GroovyClassLoader (groovy.lang.GroovyClassLoader)1 GroovyObject (groovy.lang.GroovyObject)1 MetaClassRegistry (groovy.lang.MetaClassRegistry)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1