Skip to content

Instantly share code, notes, and snippets.

@amf3
Created December 16, 2022 21:54
Show Gist options
  • Select an option

  • Save amf3/925cdf33996da6a7a9332d7b3187cfc2 to your computer and use it in GitHub Desktop.

Select an option

Save amf3/925cdf33996da6a7a9332d7b3187cfc2 to your computer and use it in GitHub Desktop.
A jruby-gradle example to manage Jekyll dependencies
/*
1) Install java 8 or java 11. (SassC fails to build with openjdk17)
2) Install Gradle 7.x. (I'm building with Gradle 7.6)
3) Create a empty direcotry, enter the new directory, copy the build.gradle file into it.
4) Run the following:
gradle wrapper
./gradlew jekyllInit
./gradlew jekyllServe
*/
plugins {
id "com.github.jruby-gradle.base" version "2.0.2"
}
repositories {
ruby.gems()
mavenCentral()
}
jruby {
jrubyVersion = '9.4.0.0'
}
dependencies {
gems "rubygems:jekyll:4.3.1"
gems "rubygems:http_parser.rb:0.6.0"
gems "rubygems:webrick:1.7.0"
gems "rubygems:minima:2.5.1"
}
task jekyllInit(type: com.github.jrubygradle.JRubyExec) {
script "jekyll"
scriptArgs "new", "$projectDir/web/src"
}
task jekyllServe(type: com.github.jrubygradle.JRubyExec) {
script "jekyll"
scriptArgs "serve", "--watch", "--source", "$projectDir/web/src" , "--destination", "$projectDir/web/_site", "--trace"
}
task jekyllBuild(type: com.github.jrubygradle.JRubyExec) {
script "jekyll"
scriptArgs "build", "$projectDir/web/src", "-d", "$projectDir/web/_site"
}
task runGradleTest {
dependsOn jekyllBuild
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment