-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtest-asciidoctor-upstream.sh
executable file
·40 lines (36 loc) · 1.81 KB
/
test-asciidoctor-upstream.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# shell script will fail if any command in this script fails
set -e
# shell script will fail if any command in a pipe will fail
set -o pipefail
# show all executed commands in log
set -x
# This script runs the AsciidoctorJ PDF tests against the specified tag (or main) of the Asciidoctor PDF Ruby gem.
GRADLE_CMD=./gradlew
# to build against a tag, set TAG to a git tag name (e.g., v1.5.2)
TAG_PDF=main
if [ "${TAG_PDF}" == "main" ]; then
SRC_DIR_PDF=asciidoctor-pdf-main
else
SRC_DIR_PDF=asciidoctor-pdf-${TAG_PDF#v}
fi
rm -rf build/maven-pdf && mkdir -p build/maven-pdf && cd build/maven-pdf
wget -O ${SRC_DIR_PDF}.zip https://github.com/asciidoctor/asciidoctor-pdf/archive/${TAG_PDF}.zip
unzip -q ${SRC_DIR_PDF}.zip
cp ../../asciidoctor-pdf-gem-installer.pom ${SRC_DIR_PDF}/pom.xml
cd ${SRC_DIR_PDF}
ASCIIDOCTOR_PDF_VERSION=$(grep 'VERSION' ./lib/asciidoctor/pdf/version.rb | sed "s/.*'\(.*\)'.*/\1/")
sed "s;<version></version>;<version>$ASCIIDOCTOR_PDF_VERSION-SNAPSHOT</version>;" pom.xml > pom.xml.sedtmp && mv -f pom.xml.sedtmp pom.xml
sed "s;^ *s\.files *.*$;s.files = Dir['*.gemspec', '*.adoc', '{bin,data,lib}/*', '{bin,data,lib}/**/*'];" asciidoctor-pdf.gemspec > asciidoctor-pdf.gemspec.sedtmp && mv -f asciidoctor-pdf.gemspec.sedtmp asciidoctor-pdf.gemspec
mvn install -B -Dgemspec=asciidoctor-pdf.gemspec
cd ../..
#rm -rf build/maven-pdf
cd ..
unset GEM_PATH GEM_HOME JRUBY_OPTS
$GRADLE_CMD -S -Pskip.signing -PasciidoctorJVersion=${ASCIIDOCTORJ_VERSION:-2.5.2} \
-PasciidoctorPdfGemVersion=${ASCIIDOCTOR_PDF_VERSION}-SNAPSHOT \
-PprawnGemVersion=${PRAWN_VERSION:-2.4.0} \
-PuseMavenLocal=true \
--no-daemon \
:asciidoctorj-pdf:clean :asciidoctorj-pdf:check
exit $?