Skip to content
Browse files

Merge pull request #16 from naamannewbold/master

  • Loading branch information...
2 parents 2fa00a8 + 3e92353 commit 0740a18a2b08c6da2115ac531016123c91a1c67a @ryanbrainard ryanbrainard committed May 8, 2012
Showing with 71 additions and 3 deletions.
  1. +3 −1 bin/common.sh
  2. +2 −2 bin/compile
  3. +19 −0 test/compile_test.sh
  4. +47 −0 test/get_property_test.sh
View
4 bin/common.sh
@@ -8,5 +8,7 @@ get_property()
# escape for regex
local escaped_key=$(echo $key | sed "s/\./\\\./g")
- [ -f $file ] && grep ^$escaped_key $file | sed -E -e "s/$escaped_key[ \t]*=[ \t]*([A-Za-z0-9\.-]*).*/\1/g"
+ [ -f $file ] && \
+ grep -E ^$escaped_key[[:space:]=]+ $file | \
+ sed -E -e "s/$escaped_key([\ \t]*=[\ \t]*|[\ \t]+)([A-Za-z0-9\.-]*).*/\2/g"
}
View
4 bin/compile
@@ -113,12 +113,12 @@ if [ "$GRAILS_VERSION" != "1.3.7" ] ; then
BUILDCMD_OPT="-plain-output"
fi
-COMPILECMD="grails -Divy.default.ivy.user.dir=$CACHE_DIR compile"
+COMPILECMD="grails -Divy.default.ivy.user.dir=$CACHE_DIR compile --non-interactive"
echo "-----> Executing $COMPILECMD"
eval "$COMPILECMD" | sed -u 's/^/ /'
check_build_status
-BUILDCMD="grails $BUILDCMD_OPT -Divy.default.ivy.user.dir=$CACHE_DIR war"
+BUILDCMD="grails $BUILDCMD_OPT -Divy.default.ivy.user.dir=$CACHE_DIR war --non-interactive"
echo "-----> Executing $BUILDCMD"
eval "$BUILDCMD" | sed -u 's/^/ /'
check_build_status
View
19 test/compile_test.sh
@@ -65,6 +65,25 @@ changeGrailsVersion()
###
+testNonInteractiveMode() {
+ createGrailsApp "2.0.0"
+ cat > ${BUILD_DIR}/scripts/_Events.groovy <<EOF
+import org.codehaus.groovy.grails.cli.CommandLineHelper
+includeTargets << grailsScript("_GrailsEvents")
+includeTargets << grailsScript("_GrailsInit")
+eventCompileStart = {
+ if (isInteractive) {
+ new CommandLineHelper().userInput("Gimme input")
+ } else {
+ println "No input allowed in non-interactive mode."
+ }
+}
+EOF
+ compile
+ assertCapturedSuccess
+ assertCaptured "Build should have succeeded with an upgraded dependency." "No input allowed in non-interactive mode."
+}
+
testCompile_Version_1_3_7()
{
local grailsVersion="1.3.7"
View
47 test/get_property_test.sh
@@ -110,3 +110,50 @@ EOF
assertCapturedSuccess
assertCapturedEquals "-${EXPECTED_VERSION}-zAc-"
}
+
+testGetPropertyWithOptionalEqualsSign() {
+ cat > ${OUTPUT_DIR}/sample.properties <<EOF
+application.version $EXPECTED_VERSION
+EOF
+ capture get_property ${OUTPUT_DIR}/sample.properties application.version
+ assertCapturedSuccess
+ assertCapturedEquals "${EXPECTED_VERSION}"
+}
+
+testGetPropertyWithNoEqualsSignNoSpaces() {
+ cat > ${OUTPUT_DIR}/sample.properties <<EOF
+application.version1234
+EOF
+ capture get_property ${OUTPUT_DIR}/sample.properties application.version
+ assertCapturedSuccess
+ assertCapturedEquals ""
+}
+
+testGetPropertyWithNoValue() {
+ cat > ${OUTPUT_DIR}/sample.properties <<EOF
+application.version
+EOF
+ capture get_property ${OUTPUT_DIR}/sample.properties application.version
+ assertCapturedSuccess
+ assertCapturedEquals ""
+}
+
+testGetPropertyWithSimilarNames() {
+ cat > ${OUTPUT_DIR}/sample.properties <<EOF
+application.version=${EXPECTED_VERSION}
+application.version.new=${EXPECTED_VERSION}-new
+EOF
+ capture get_property ${OUTPUT_DIR}/sample.properties application.version.new
+ assertCapturedSuccess
+ assertCapturedEquals "${EXPECTED_VERSION}-new"
+}
+
+testGetPropertyWithSimilarNameReverseOrder() {
+ cat > ${OUTPUT_DIR}/sample.properties <<EOF
+application.version.new=${EXPECTED_VERSION}-new
+application.version=${EXPECTED_VERSION}
+EOF
+ capture get_property ${OUTPUT_DIR}/sample.properties application.version.new
+ assertCapturedSuccess
+ assertCapturedEquals "${EXPECTED_VERSION}-new"
+}

0 comments on commit 0740a18

Please sign in to comment.
Something went wrong with that request. Please try again.