Commit b1e80d44 authored by George Adrian Stoica's avatar George Adrian Stoica
Browse files

work on support for windows

parent da759cf4
Pipeline #53413 passed with stage
in 2 minutes and 19 seconds
...@@ -120,22 +120,21 @@ task checkDocker { ...@@ -120,22 +120,21 @@ task checkDocker {
doLast{ doLast{
def result = 1 def result = 1
if (Os.isFamily(Os.FAMILY_WINDOWS)) { if (Os.isFamily(Os.FAMILY_WINDOWS)) {
println "windows os" println "windows os"
result = exec{ result = exec{
def command = "/c docker --version" def command = "/c docker --version"
ignoreExitValue = true ignoreExitValue = true
executable "cmd" args command executable "cmd" args command
} }
} else { } else {
//we assume linux/mac with bash if not having windows - //we assume linux/mac with bash if not having windows -
//more fine tuned testing can be done if needed //more fine tuned testing can be done if needed
println "linux / unix os" println "linux / unix os"
result = exec{ result = exec{
def command = "command -v docker" def command = "command -v docker"
ignoreExitValue = true ignoreExitValue = true
executable "bash" args "-l", "-c", command executable "bash" args "-l", "-c", command
} }
} }
if(result.getExitValue()==0){ if(result.getExitValue()==0){
...@@ -149,15 +148,38 @@ task checkDocker { ...@@ -149,15 +148,38 @@ task checkDocker {
} }
task pdfSlides { task pdfSlides {
doLast{
if (dockerAvailable){ if (dockerAvailable){
if (Os.isFamily(Os.FAMILY_WINDOWS)) { if (Os.isFamily(Os.FAMILY_WINDOWS)) {
println "run windows script" def result = exec{
workingDir = '.'
ignoreExitValue = true
commandLine 'cmd','/c','pdfslides.bat'
}
if(result.getExitValue()==0){
println "export successful"
} else {
print "export to pdf failed"
}
} else { } else {
def result = exec{
def command = "pdfslides.sh"
ignoreExitValue = true
executable "bash" args "-l", "-c", command
}
if(result.getExitValue()==0){
println "export successful"
} else {
print "export to pdf failed"
}
println "run linux / unix script" println "run linux / unix script"
} }
} else { } else {
println "docker is not available on this machine" println "docker is not available on this machine"
} }
}
} }
build.dependsOn 'asciidoctorRevealJs' build.dependsOn 'asciidoctorRevealJs'
......
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
SET CURRENT_PATH=%~dp0
SET "URL_SLIDES=https://gitlab.stud.idi.ntnu.no/it1901/course-material/-/jobs/artifacts/master/file/lectures/build/docs/revealjs/"
rem using 2.9 as the latest vesion is not working properly in our case
SET "DOCKER_PARAMS=run --rm -t -v ^"%CURRENT_PATH%build\docs\pdf^":/slides astefanutti/decktape:2.9 --size=1280x1000"
docker %DOCKER_PARAMS% %URL_SLIDES%course-intro.html?job=build 01.a.course-intro-slides.pdf
docker %DOCKER_PARAMS% %URL_SLIDES%02-software-development.html?job=build 02.a.software-development-slides.pdf
docker %DOCKER_PARAMS% %URL_SLIDES%scm.html?job=build 02.b.source-code-management.pdf
docker %DOCKER_PARAMS% %URL_SLIDES%03-build-tools-and-some-testing.html?job=build 03-build-tools-and-some-testing.pdf
docker %DOCKER_PARAMS% %URL_SLIDES%07-documentation.html?job=build 07.b.-documentation.pdf
docker %DOCKER_PARAMS% %URL_SLIDES%08-workflow-example.html?job=build 08.workflow-example.pdf
\ No newline at end of file
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
URL_SLIDES="https://gitlab.stud.idi.ntnu.no/it1901/course-material/-/jobs/artifacts/master/file/lectures/build/docs/revealjs/" URL_SLIDES="https://gitlab.stud.idi.ntnu.no/it1901/course-material/-/jobs/artifacts/master/file/lectures/build/docs/revealjs/"
#using 2.9 as the latest vesion is not working properly in our case #using 2.9 as the latest vesion is not working properly in our case
DOCKER_PARAMS="run --rm -t -v `pwd`:/slides astefanutti/decktape:2.9" DOCKER_PARAMS="run --rm -t -v `pwd`:/slides astefanutti/decktape:2.9 --size=1280x1000"
docker ${DOCKER_PARAMS} --size=1280x1000 ${URL_SLIDES}course-intro.html?job=build 01.a.course-intro-slides.pdf docker ${DOCKER_PARAMS} ${URL_SLIDES}course-intro.html?job=build 01.a.course-intro-slides.pdf
docker ${DOCKER_PARAMS} --size=1280x1000 ${URL_SLIDES}02-software-development.html?job=build 02.a.software-development-slides.pdf docker ${DOCKER_PARAMS} ${URL_SLIDES}02-software-development.html?job=build 02.a.software-development-slides.pdf
docker ${DOCKER_PARAMS} --size=1280x1000 ${URL_SLIDES}scm.html?job=build 02.b.source-code-management.pdf docker ${DOCKER_PARAMS} ${URL_SLIDES}scm.html?job=build 02.b.source-code-management.pdf
docker ${DOCKER_PARAMS} --size=1280x1000 ${URL_SLIDES}03-build-tools-and-some-testing.html?job=build 03-build-tools-and-some-testing.pdf docker ${DOCKER_PARAMS} ${URL_SLIDES}03-build-tools-and-some-testing.html?job=build 03-build-tools-and-some-testing.pdf
docker ${DOCKER_PARAMS} --size=1280x1000 ${URL_SLIDES}07-documentation.html?job=build 07.b.-documentation.pdf docker ${DOCKER_PARAMS} ${URL_SLIDES}07-documentation.html?job=build 07.b.-documentation.pdf
docker ${DOCKER_PARAMS} --size=1280x1000 ${URL_SLIDES}08-workflow-example.html?job=build 08.workflow-example.pdf docker ${DOCKER_PARAMS} ${URL_SLIDES}08-workflow-example.html?job=build 08.workflow-example.pdf
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
SET CURRENT_PATH=%~dp0
SET "URL_SLIDES=/revealjs/"
rem using 2.9 as the latest vesion is not working properly in our case
SET "DOCKER_PARAMS=run --rm -t -v ^"%CURRENT_PATH%build\docs\pdf^":/slides -v ^"%CURRENT_PATH%build\docs\revealjs^":/revealjs astefanutti/decktape:2.9 --size=1280x1000 --chrome-arg=--allow-file-access-from-files"
docker %DOCKER_PARAMS% "%URL_SLIDES%course-intro.html" 01.a.course-intro-slides.pdf
docker %DOCKER_PARAMS% %URL_SLIDES%02-software-development.html 02.a.software-development-slides.pdf
docker %DOCKER_PARAMS% %URL_SLIDES%scm.html 02.b.source-code-management.pdf
docker %DOCKER_PARAMS% %URL_SLIDES%03-build-tools-and-some-testing.html 03-build-tools-and-some-testing.pdf
docker %DOCKER_PARAMS% %URL_SLIDES%07-documentation.html 07.b.-documentation.pdf
docker %DOCKER_PARAMS% %URL_SLIDES%08-workflow-example.html 08.workflow-example.pdf
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment