ci/ci-pharo-common.sh
changeset 549 8ad6734770cd
child 550 777f3813febc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ci/ci-pharo-common.sh	Mon Nov 09 00:38:23 2015 +0000
@@ -0,0 +1,54 @@
+#
+# A set of functions to be used in PetitParser's Pharo CI jobs
+#
+
+if test -x "ci-common.sh"; then
+    echo wget -O "ci-common.sh" https://bitbucket.org/janvrany/stx-goodies-petitparser/raw/tip/ci/ci-common.sh
+fi
+. ci-common.sh
+
+
+IMAGE_BASE=PetitParser-$BUILD_NUMBER
+IMAGE=$IMAGE_BASE.image
+
+# A function to download Pharo. The version of Pharo 
+# is taken from environment variable PHARO. If it's not
+# defined, defaults to  Pharo 5.0 
+function ci_pharo_download_pharo {
+    if [ -z "$PHARO" ]; then
+        PHARO=5.0
+    fi
+
+    if [ ! -x pharo-ui ]; then
+        rm -rf pharo pharo-ui pharo-vm
+        wget -O- http://swing.fit.cvut.cz/download/pharo/vm-swing | bash
+    fi
+
+    if [ ! -r Pharo.image ]; then
+        rm -rf Pharo.image Pharo.changes
+        if [ "$PHARO" == "3.0" ]; then
+            wget -O- get.pharo.org/30 | bash
+        elif [  "$PHARO" == "4.0"  ]; then
+            wget -O- get.pharo.org/40 | bash
+        elif [  "$PHARO" == "5.0"  ]; then
+            wget -O- get.pharo.org/50 | bash   
+        else
+            echo "Unknown PHARO version: $PHARO"
+            exit 1
+        fi
+    fi
+}
+
+# A function to download PetitCompiler and build an image
+
+function ci_pharo_download_petitparser {
+    ./pharo Pharo.image save $IMAGE_BASE
+    ./pharo $IMAGE config http://smalltalkhub.com/mc/JanVrany/CalipeL-S/main ConfigurationOfCalipeLS --install=0.1
+    ./pharo $IMAGE eval --save "
+
+    Gofer new smalltalkhubUser: 'JanKurs' project: 'PetitParser';
+        configurationOf: #PetitCompiler; load.
+    (Smalltalk at: #ConfigurationOfPetitCompiler) perform: #'loadDevelopment'.
+    "
+}
+