Grain Gradle Plugin Released

SysGears team is glad to announce the first release of Grain Gradle Plugin. The plugin allows to manage Grain themes by using a set of predefined Gradle tasks, and makes it much easier to integrate any Grain website with existing Gradle projects, for instance, to create a project documentation.

To use the plugin, simply add the following to your build.gradle file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.sysgears.grain:grain-gradle-plugin:0.1.1'
    }
}

apply plugin: 'grain'

repositories {
    mavenCentral()
}

grain {
    projectDir = 'src/site' // relative path to the site sources
}

Then put your Grain site sources to the directory specified in grain.projectDir property (to start with, you can use one of the Grain themes).

Below is the list of Grain tasks to be added by plugin to your project:

  • gradle grainPreview - launches website in a preview mode
  • gradle grainGenerate - generates the website files to the destination directory (see filesystem)
  • gradle grainDeploy - deploys the resulting files (see deployment configuration)
  • gradle grainClean - cleans the site destination and target directories

Besides that, you can run your own Grain commands from the build script. For example, if you have the compress command to gzip site files before deploying, you can simply execute it by creating task of type GrainTask:

1
2
3
4
5
task(grainCompress, type: com.sysgears.grain.gradle.GrainTask) {
   command = 'compress' // the name of the custom command
   // arguments = []    // the arguments to pass to the command
   // jvmArguments = [] // JVM arguments to launch Grain process
}

Please note that the plugin sources and the issue tracker can be found on plugin’s GitHub page here. For questions and suggestions please email us at the Grain mailing list.

Best Regards,
SysGears team

Comments