Correctly getting the build signature properties into the MANIFEST.MF

on build, now testing I'm clearing them down again before commit.
This commit is contained in:
Simon Brooke 2014-07-27 11:58:29 +01:00
parent 5d3f79567b
commit 0e140a4666
4 changed files with 47 additions and 21 deletions

View file

@ -13,6 +13,7 @@ fullname=`grep ${USER} /etc/passwd | awk -F\: '{print $5}' | awk -F\, '{print $1
webappsdir="/var/lib/tomcat7/webapps" webappsdir="/var/lib/tomcat7/webapps"
release="" release=""
trial="FALSE" trial="FALSE"
tmp=buildall.tmp.$$
# Builds the build signature properties in the manifest map file # Builds the build signature properties in the manifest map file
# expected arguments: old version tag, version tag, full name of user, # expected arguments: old version tag, version tag, full name of user,
@ -52,12 +53,12 @@ function setup-build-sig {
t=`date --rfc-3339 seconds` t=`date --rfc-3339 seconds`
fi fi
cat <<-EOF > buildall.tmp/manifest.sed cat <<-EOF > ${tmp}/manifest.sed
s/${o}/${v}/g s/${o}/${v}/g
s/^ *"build-signature-version" ".*" *\$/\t\t"build-signature-version" "${v}"/
s/^ *"build-signature-user" ".*" *\$/\t\t"build-signature-user" "${u}"/ s/^ *"build-signature-user" ".*" *\$/\t\t"build-signature-user" "${u}"/
s/^ *"build-signature-email" ".*" *\$/\t\t"build-signature-email" "${e}"/ s/^ *"build-signature-email" ".*" *\$/\t\t"build-signature-email" "${e}"/
s/^ *"build-signature-timestamp" ".*" *\$/\t\t"build-signature-timestamp" "${t}"/ s/^ *"build-signature-timestamp" ".*" *\$/\t\t"build-signature-timestamp" "${t}"/
s/^ *"build-signature-version" ".*" *\$/\t\t"build-signature-version" "${v}"/
EOF EOF
} }
@ -125,13 +126,13 @@ for dir in mw-*
do do
pushd ${dir} pushd ${dir}
if [ ! -d "buildall.tmp" ] if [ ! -d "${tmp}" ]
then then
rm -f "buildall.tmp" rm -f "${tmp}"
mkdir "buildall.tmp" mkdir "${tmp}"
fi fi
cat project.clj > buildall.tmp/project.bak.1 cat project.clj > ${tmp}/project.bak.1
old=`cat project.clj | grep 'defproject mw' | sed 's/.*defproject mw-[a-z]* "\([A-Za-z0-9_.-]*\)".*/\1/'` old=`cat project.clj | grep 'defproject mw' | sed 's/.*defproject mw-[a-z]* "\([A-Za-z0-9_.-]*\)".*/\1/'`
if [ "${release}" != "" ] if [ "${release}" != "" ]
@ -153,13 +154,13 @@ do
message="Upversioned from ${old} to ${interim} for release" message="Upversioned from ${old} to ${interim} for release"
old=${interim} old=${interim}
else else
setup-build-sig "${old}" "${old}" "${fullname}" "${email}" setup-build-sig "unset" "${old}" "${fullname}" "${email}"
fi fi
else else
setup-build-sig "${old}" "${old}" "${fullname}" "${email}" setup-build-sig "unset" "${old}" "${fullname}" "${email}"
fi fi
sed -f buildall.tmp/manifest.sed buildall.tmp/project.bak.1 > project.clj sed -f ${tmp}/manifest.sed ${tmp}/project.bak.1 > project.clj
echo $message echo $message
@ -181,9 +182,9 @@ do
lein marg lein marg
lein install lein install
cat project.clj > buildall.tmp/project.bak.2 cat project.clj > ${tmp}/project.bak.2
setup-build-sig "${old}" setup-build-sig
sed -f buildall.tmp/manifest.sed buildall.tmp/project.bak.2 > project.clj sed -f ${tmp}/manifest.sed ${tmp}/project.bak.2 > project.clj
if [ "${trial}" = "FALSE" ] if [ "${trial}" = "FALSE" ]
then then
@ -205,9 +206,9 @@ do
git push origin "${branch}" git push origin "${branch}"
fi fi
cat project.clj > buildall.tmp/project.bak.3 cat project.clj > ${tmp}/project.bak.3
setup-build-sig "${old}" "${release}-SNAPSHOT" "${fullname}" "${email}" setup-build-sig "${old}" "${release}-SNAPSHOT" "${fullname}" "${email}"
sed -f buildall.tmp/manifest.sed buildall.tmp/project.bak.3 > project.clj sed -f ${tmp}/manifest.sed ${tmp}/project.bak.3 > project.clj
message="Upversioned from ${interim} to ${release}-SNAPSHOT" message="Upversioned from ${interim} to ${release}-SNAPSHOT"
echo $message echo $message
@ -222,9 +223,9 @@ do
lein marg lein marg
lein install lein install
cat project.clj > buildall.tmp/project.bak.4 cat project.clj > ${tmp}/project.bak.4
setup-build-sig "${release}-SNAPSHOT" setup-build-sig
sed -f buildall.tmp/manifest.sed buildall.tmp/project.bak.4 > project.clj sed -f ${tmp}/manifest.sed ${tmp}/project.bak.4 > project.clj
if [ "${trial}" = "FALSE" ] if [ "${trial}" = "FALSE" ]
then then
@ -239,9 +240,11 @@ do
if [ "${dir}" = "mw-ui" ] if [ "${dir}" = "mw-ui" ]
then then
lein ring uberwar lein ring uberwar
sudo cp buildall.tmp/microworld.war /var/lib/tomcat7/webapps sudo cp target/microworld.war /var/lib/tomcat7/webapps
echo "Deployed new WAR file to local Tomcat" echo "Deployed new WAR file to local Tomcat"
fi fi
# rm -rf "${tmp}"
popd popd
done done

View file

@ -1,13 +1,13 @@
(defproject mw-engine "unset" (defproject mw-engine "0.1.2-SNAPSHOT"
:description "Cellular automaton world builder." :description "Cellular automaton world builder."
:url "http://www.journeyman.cc/microworld/" :url "http://www.journeyman.cc/microworld/"
:manifest { :manifest {
;; do not reformat this! It is important for the buildall script ;; do not reformat this! It is important for the buildall script
;; that each of these properties is on a line with nothing else. ;; that each of these properties is on a line with nothing else.
"build-signature-version" "unset" "build-signature-version" "0.1.2-SNAPSHOT"
"build-signature-user" "Simon Brooke" "build-signature-user" "Simon Brooke"
"build-signature-email" "simon@journeyman.cc" "build-signature-email" "simon@journeyman.cc"
"build-signature-timestamp" "2014-07-27 11:19:57+01:00" "build-signature-timestamp" "2014-07-27 11:54:52+01:00"
} }
:license {:name "GNU General Public License v2" :license {:name "GNU General Public License v2"

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

View file

@ -0,0 +1,23 @@
(ns mw-engine.heightmap-test
(:require [clojure.test :refer :all]
[mw-engine.heightmap :refer :all]
[clojure.math.combinatorics :as combo]))
(deftest apply-heightmap-test
(testing "Heightmap functionality"
(let [world (apply-heightmap "heightmaps/test9x9.png")
altitudes (map #(:altitude %) (flatten world))
gradients (map #(:gradient %) (flatten world))]
(is (= (count world) 9) "World should be 9x9")
(is (= (count (first world)) 9) "World should be 9x9")
(is (= (count (remove nil? altitudes)) 81)
"All cells should have altitude")
(is (= (count (remove nil? gradients)) 81)
"All cells should have gradient")
(is (> (apply max altitudes)
(apply min altitudes))
"There should be a range of altitudes")
(is (> (apply + gradients) 0)
"At least some gradients must be positive, none should be negative")
)))