Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.log
/grails-config-chooser-*.zip
/grails-config-chooser-*.zip.sha1
/plugin.xml
/target
/web-app/WEB-INF
55 changes: 9 additions & 46 deletions ConfigChooserGrailsPlugin.groovy
Original file line number Diff line number Diff line change
@@ -1,89 +1,52 @@
import grails.plugin.configChooser.helper.ConfigChooserHelper

class ConfigChooserGrailsPlugin {
// the plugin version
def version = "0.5.1"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "2.0 > *"

def groupId = 'ch.wadeck'

def loadAfter = ['pluginConfig']

// resources that are excluded from plugin packaging
def pluginExcludes = [
"grails-app/views/**",
"web-app/**",
// remove all the classes that are used to test
"**/test/**"
]

// Headline display name of the plugin
def title = "Config Chooser Plugin"
def author = "Wadeck Follonier"
def authorEmail = "[email protected]"
def description = '''\
Allow the developper to choose the configuration on the fly by using a JDialog poping with different config proposal. Useful when working with multiple database source
'''

// URL to the plugin's documentation
def description = 'Allow the developer to choose the configuration on the fly by using a JDialog poping with different config proposal. Useful when working with multiple database source'
def documentation = "https://github.com/Wadeck/grails-config-chooser"

// it watches config files and defaultConfig files
def observe = ['pluginConfig']

// Extra (optional) plugin metadata

// License: one of 'APACHE', 'GPL2', 'GPL3'
// def license = "APACHE"

// Details of company behind the plugin (if there is one)
// def organization = [ name: "My Company", url: "http://www.my-company.com/" ]

// Any additional developers beyond the author specified above.
def observe = ['pluginConfig'] // it watches config files and defaultConfig files
def license = "APACHE"
def developers = [
[name: "Wadeck Follonier", email: "[email protected]"]
]

// Location of the plugin's issue tracker.
def issueManagement = [system: "GITHUB", url: "https://github.com/Wadeck/grails-config-chooser"]

// Online location of the plugin's browseable source code.
def scm = [url: "https://github.com/Wadeck/grails-config-chooser"]

def doWithWebDescriptor = { xml ->
ConfigChooserHelper.getInstance().execute(application)
ConfigChooserHelper.instance.execute(application)
}

def doWithSpring = {
ConfigChooserHelper.getInstance().execute(application)
ConfigChooserHelper.instance.execute(application)
}

def doWithDynamicMethods = { ctx ->
ConfigChooserHelper.getInstance().execute(application)
ConfigChooserHelper.instance.execute(application)
}

def doWithApplicationContext = { ctx ->
ConfigChooserHelper.getInstance().execute(application)
ConfigChooserHelper.instance.execute(application)
}

def onChange = { event ->
// watching is modified and reloaded. The event contains: event.source,
// event.application, event.manager, event.ctx, and event.plugin.
println '[ConfigChooser] onChange'
}

def onConfigChange = { event ->
// The event is the same as for 'onChange'.
// println '[ConfigChooser] onConfigChange'

// normally at this point we lost the user choice
ConfigChooserHelper.getInstance().execute(application)
ConfigChooserHelper.getInstance().destroy()
}

def onShutdown = { event ->
// Implement code that is executed when the application shuts down (optional)
ConfigChooserHelper.instance.execute(application)
ConfigChooserHelper.instance.destroy()
}

def afterConfigMerge = { config, mergeCtx ->
Expand Down
2 changes: 0 additions & 2 deletions application.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#Grails Metadata file
#Sat Nov 15 14:39:49 CET 2014
app.grails.version=2.3.11
app.name=config-chooser
57 changes: 14 additions & 43 deletions grails-app/conf/BuildConfig.groovy
Original file line number Diff line number Diff line change
@@ -1,61 +1,32 @@
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.work.dir = 'target'

grails.project.fork = [
// configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required
// compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true],

// configure settings for the test-app JVM, uses the daemon by default
test : false,
// configure settings for the run-app JVM
run : false,
// configure settings for the run-war JVM
war : [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve: false],
// configure settings for the Console UI JVM
console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]

// enable the run-war command line to avoid permgen space out of memory exception
// for java <8
// enable the run-war command line to avoid permgen space out of memory exception for java <8
grails.tomcat.jvmArgs = ["-Xms256m", "-Xmx1024m", "-XX:PermSize=512m", "-XX:MaxPermSize=512m"]
// for java >=8 (no more permGem support)
//grails.tomcat.jvmArgs = ["-Xms256m", "-Xmx1024m"]

grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolver = 'maven'
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}

log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
inherits 'global'
log 'warn'

repositories {
grailsCentral()
mavenLocal()
mavenCentral()
// uncomment the below to enable remote dependency resolution
// from public Maven repositories
// mavenRepo "http://repository.codehaus.org"
// mavenRepo "http://download.java.net/maven/2/"
// mavenRepo "http://repository.jboss.com/maven2/"
}

dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
// runtime 'mysql:mysql-connector-java:5.1.27'
}

plugins {
// plugins for the build system only
build ":tomcat:7.0.54"
build(
":release:3.0.1",
":rest-client-builder:1.0.3",
) {

build ":tomcat:7.0.55", {
export = false
}

build(':release:3.0.1', ':rest-client-builder:2.0.3') {
export = false
}

compile ':plugin-config:0.2.0'
}
}
Expand All @@ -67,4 +38,4 @@ grails.project.repos.artifactory.type = "maven"
// creditentials are stored in separate file, %HOME%/.grails/settings.groovy
// due to a bug, those lines must not be uncommented, they are just for information
// grails.project.repos.artifactory.username = "not-public"
// grails.project.repos.artifactory.password = "not-public"
// grails.project.repos.artifactory.password = "not-public"
61 changes: 24 additions & 37 deletions grails-app/conf/Config.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import grails.util.Environment
import org.apache.commons.io.FilenameUtils

import org.apache.log4j.DailyRollingFileAppender
import org.apache.log4j.Layout
import org.apache.log4j.Logger
Expand Down Expand Up @@ -33,77 +33,64 @@ log4j = {
if (!logDirectory) {
logDirectory = System.getProperty('grailsProjectPath')
if (!logDirectory) {
Map<String, String> envVars = System.getenv()
logDirectory = envVars.get('grailsProjectPath')
logDirectory = System.getenv('grailsProjectPath')
if (logDirectory) {
logDirectory = FilenameUtils.concat(logDirectory, applicationName)
logDirectory += '/' + applicationName
}
if (!logDirectory) {
else {
String defaultOsPath
if (System.getProperty("os.name").toLowerCase().contains('windows')) {
defaultOsPath = 'C:\\defaultGrailsProject'
defaultOsPath = 'C:/defaultGrailsProject'
} else {
defaultOsPath = '/etc/defaultGrailsProject'
}
logDirectory = FilenameUtils.concat(defaultOsPath, applicationName)
logDirectory = defaultOsPath + '/' + applicationName
}
}
}

String logFilename = config.log.filename ?: applicationName

appender new DailyRollingFileAppender(name: 'logfile', file: logDirectory + File.separator + logFilename + ".log", datePattern: "'.'yyyy-MM-dd", layout: logLayout)
appender new RollingFileAppender(name: 'stacktrace', file: logDirectory + File.separator + "_stacktrace.log", layout: logLayout)
appender new DailyRollingFileAppender(name: 'logfile', file: new File(logDirectory, logFilename + ".log"), datePattern: "'.'yyyy-MM-dd", layout: logLayout)
appender new RollingFileAppender(name: 'stacktrace', file: new File(logDirectory, "_stacktrace.log"), layout: logLayout)
}

root {
if (Environment.getCurrentEnvironment() in [Environment.DEVELOPMENT]) {
if (Environment.developmentMode) {
info('stdout', 'logfile')
} else if (Environment.getCurrentEnvironment() in [Environment.TEST]) {
} else if (Environment.current == Environment.TEST) {
warn('logfile')
} else {
error('logfile')
}
additivity = false
}

error 'org.codehaus.groovy.grails.web.servlet', // controllers
'org.codehaus.groovy.grails.web.pages', // GSP
'org.codehaus.groovy.grails.web.sitemesh', // layouts
'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
'org.codehaus.groovy.grails.web.mapping', // URL mapping
'org.codehaus.groovy.grails.commons', // core / classloading
'org.codehaus.groovy.grails.plugins', // plugins
'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
'org.springframework',
'org.hibernate',
'net.sf.ehcache.hibernate',
'net.sf.jmimemagic'

if (Environment.getCurrentEnvironment() in [Environment.DEVELOPMENT, Environment.TEST]) {
debug 'grails.app'

warn 'org.mortbay.log',
'org.apache.ddlutils'
error 'org.codehaus.groovy.grails',
'org.springframework',
'org.hibernate',
'net.sf.ehcache.hibernate',
'net.sf.jmimemagic'

if (Environment.current in [Environment.DEVELOPMENT, Environment.TEST]) {
debug 'grails.app'
warn 'org.apache.ddlutils'
} else {
warn 'org.mortbay.log',
'org.apache.ddlutils',
'grails.app'
warn 'org.apache.ddlutils', 'grails.app'
}

if (Environment.getCurrentEnvironment() == Environment.DEVELOPMENT) {
if (Environment.developmentMode) {
// debug sql queries
// trace 'org.hibernate.SQL' //, 'org.hibernate.type'
// debug 'org.hibernate.SQL'
// trace 'org.hibernate.type.descriptor.sql.BasicBinder'

// debug all security concerns
// debug 'org.springframework.security'
}
}

environments {
def logger = Logger.getRootLogger()
production {
logger.removeAppender('stdout')
Logger.rootLogger.removeAppender('stdout')
}
}
}
Loading