Last active
March 15, 2016 20:24
-
-
Save ysb33r/a105cd0ee27b16eac777 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a workaround for the Grain plugin for Gradle | |
// It generates the Grain build into a subproject if one runs grainInstall | |
// It also elimnates the current way Grain drops stuff all over your build area. | |
// IN reality the Grain plugin needs a rewrite, but this is a workaround for now. | |
plugins { | |
id "com.sysgears.grain" version "0.2.3" | |
} | |
grain { | |
projectDir = file 'site' | |
} | |
task grainInstall(type: com.sysgears.grain.gradle.GrainInstallTask) { | |
theme = 'portfolio' | |
version = '0.4.3' | |
outputs.upToDateWhen { file(grain.projectDir).exists() } | |
doLast { | |
['gradle','gradlew','gradlew.bat'].each { | |
project.delete "${grain.projectDir}/${it}" | |
} | |
def settingsFile = new File('settings.gradle') | |
String settingsText = "include 'site'" | |
if(!settingsFile.exists() || settingsFile.text.contains(settingsText)) { | |
settingsFile.withWriterAppend { w -> | |
w.println settingsText | |
} | |
} | |
def addPlugin = new File(grain.projectDir,'build.gradle') | |
def baseText = addPlugin.text | |
addPlugin.withWriter { w -> | |
w.println "apply plugin : 'com.sysgears.grain'" | |
w.println "grain.projectDir = project.projectDir" | |
w.println "grainInstall.ebaled = false" | |
w << baseText | |
} | |
} | |
} | |
['grainClean','grainDeploy','grainGenerate','grainPreview'].each { | |
tasks."${it}".enabled = false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment