From 6d8294c2150f97a670f5e842c7e96a1848b8db6b Mon Sep 17 00:00:00 2001 From: Andrea Di Giorgi Date: Fri, 20 Mar 2015 14:33:11 -0700 Subject: [PATCH] LPS-51081 Create theme --- sdk.gradle | 31 +++++++++++++++++++++++++++++++ util.gradle | 6 ++++++ 2 files changed, 37 insertions(+) diff --git a/sdk.gradle b/sdk.gradle index 5050f6c5b424..92d06683b953 100644 --- a/sdk.gradle +++ b/sdk.gradle @@ -1,6 +1,8 @@ import org.apache.commons.codec.digest.DigestUtils import org.apache.tools.ant.filters.ReplaceTokens +apply from: "util.gradle" + buildscript { dependencies { classpath group: "commons-codec", name: "commons-codec", version: "1.9" @@ -15,6 +17,7 @@ buildscript { task compareDists task createLayouttpl +task createTheme compareDists << { Closure compareDistFileContents @@ -191,3 +194,31 @@ createLayouttpl << { } } } + +createTheme << { + File themeDir = file("themes/${themeName}-theme") + + if (themeDir.exists()) { + println "${themeName} already exists." + + return + } + + copy { + filter(ReplaceTokens, tokens: [ + "theme.display.name": themeDisplayName, + "theme.name": themeName, + "plugin.type.dir": ".." + ]) + + from "${rootDir}/tools/templates/theme_tmpl" + + into themeDir + } + + mkdirs("${themeDir}/docroot/_diffs") + mkdirs("${themeDir}/docroot/WEB-INF/src/resources-importer/document_library/documents") + mkdirs("${themeDir}/docroot/WEB-INF/src/resources-importer/journal/articles") + mkdirs("${themeDir}/docroot/WEB-INF/src/resources-importer/journal/structures") + mkdirs("${themeDir}/docroot/WEB-INF/src/resources-importer/journal/templates") +} \ No newline at end of file diff --git a/util.gradle b/util.gradle index 5aa8b1e764b2..7ef3350cc139 100644 --- a/util.gradle +++ b/util.gradle @@ -20,6 +20,12 @@ class UtilPluginConvention { file.exists() } + void mkdirs(String pathName) { + File file = _project.file(pathName) + + file.mkdirs() + } + private Project _project } \ No newline at end of file