Skip to content

Commit

Permalink
Attempt to avoid initialization of AntBuilder inside Grails to avoid …
Browse files Browse the repository at this point in the history
…permissions problems
  • Loading branch information
graemerocher committed Apr 16, 2009
1 parent 7e14ff2 commit 4aa4eb3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ public class GrailsPluginUtils {
static final String WILDCARD = "*";
public static final GRAILS_HOME
static {
def ant = new AntBuilder()
ant.property(environment: "env")
GRAILS_HOME = ant.antProject.properties."env.GRAILS_HOME"
try {
GRAILS_HOME = System.getenv("GRAILS_HOME")
}
catch (Throwable t) {
// probably due to permissions error
GRAILS_HOME = "UNKNOWN"
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class DefaultGrailsTemplateGenerator implements GrailsTemplateGenerator, Resourc
String basedir = "."
boolean overwrite = false
def engine = new SimpleTemplateEngine()
def ant = new AntBuilder()
ResourceLoader resourceLoader
Template renderEditorTemplate

Expand Down Expand Up @@ -210,6 +209,7 @@ class DefaultGrailsTemplateGenerator implements GrailsTemplateGenerator, Resourc
private canWrite(testFile) {
if (!overwrite && testFile.exists()) {
try {
def ant = new AntBuilder()
ant.input(message: "File ${testFile} already exists. Overwrite?", "y,n,a", addproperty: "overwrite.${testFile.name}")
overwrite = (ant.antProject.properties."overwrite.${testFile.name}" == "a") ? true : overwrite
return overwrite || ((ant.antProject.properties."overwrite.${testFile.name}" == "y") ? true : false)
Expand Down

This file was deleted.

0 comments on commit 4aa4eb3

Please sign in to comment.