From: Ronald Haeder Date: Mon, 18 Apr 2016 14:00:39 +0000 (+0200) Subject: Improvements X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b4766b712c1c0d5b464de63811f51dbfa549f588;p=jprojects-scripts.git Improvements --- diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.jprojects.sh b/.jprojects.sh index c2178e1..ae46e92 100644 --- a/.jprojects.sh +++ b/.jprojects.sh @@ -30,12 +30,14 @@ LIST="${LIST} addressbook-swing" # Own home directory declare -r JPROJECTS_HOME="${PWD}" +# ant binary +ANT_BIN=`which ant` + # Test on .git availability" for project in ${LIST}; do if [ ! -d "${project}" ] then echo "$0: Project '${project}' not created." - exit 1 elif [ ! -f "${project}/.git/config" ] then echo "$0: Project '${project}' is no GIT project." diff --git a/build-dist-all.sh b/build-dist-all.sh index 1738107..5ac2a3e 100755 --- a/build-dist-all.sh +++ b/build-dist-all.sh @@ -2,9 +2,15 @@ . ./.jprojects.sh || exit 255 -for DIST in ${LIST}; do - echo "$0: Executing '${DIST}' ..." - P=${DIST%/*} +for project in ${LIST}; do + if [ ! -d "${JPROJECTS_HOME}/${project}" ] + then + echo "$0: Project '${project}' does not exist." + continue; + fi + + echo "$0: Executing '${project}' ..." + P=${project%/*} echo "$0: P='${P}'" cd "${JPROJECTS_HOME}/${P}" || exit 255 @@ -15,10 +21,10 @@ for DIST in ${LIST}; do continue fi - if [ "$1" != "d" ] + if [ -x "${ANT_BIN}" -a "$1" != "d" ] then # Cleanup project and build JAR - ant clean jar + ${ANT_BIN} clean jar # Save status STATUS="$?" @@ -27,13 +33,13 @@ for DIST in ${LIST}; do if [ "${STATUS}" != "0" ] then # This has failed, so try "dist" - ant clean dist + ${ANT_BIN} clean dist STATUS="$?" # Still failing? Oh, to bad if [ "${STATUS}" != "0" ] then - echo "$0: Failed to build '${DIST}'." + echo "$0: Failed to build '${project}'." exit 1 fi fi @@ -41,10 +47,10 @@ for DIST in ${LIST}; do if [ ! -f "./dist.sh" ] then - echo "$0: Project '${DIST}' has no dist.sh" + echo "$0: Project '${project}' has no dist.sh" elif [ ! -e "./dist.sh" ] then - echo "$0: Error: Project '${DIST}' has non-executable dist.sh!" + echo "$0: Error: Project '${project}' has non-executable dist.sh!" exit 1 else ./dist.sh diff --git a/cp-dist.sh b/cp-dist.sh index 41cb9d6..ad4d9b6 100755 --- a/cp-dist.sh +++ b/cp-dist.sh @@ -7,17 +7,17 @@ for project in ${LIST}; do then echo "$0: Skipping jprojects-scripts ..." continue - elif [ -f "${project}/dist.sh" ] + elif [ -f "${JPROJECTS_HOME}/${project}/dist.sh" ] then echo "$0: Copying dist.sh to '${project}' ..." - cp -v dist.sh "${project}/" || exit 255 + cp -v dist.sh "${JPROJECTS_HOME}/${project}/" || exit 255 fi - if [ ! -d "${project}/docs" -o "$1" = "f" ] + if [ -d "${JPROJECTS_HOME}/${project}" -a ! -d "${JPROJECTS_HOME}/${project}/docs" -o "$1" = "f" ] then echo "$0: GNU-ifying project '${project}' ..." - mkdir --parent "${project}/docs" || exit 255 - cp -rpv docs/* "${project}/docs/" || exit 255 + mkdir --parent "${JPROJECTS_HOME}/${project}/docs" || exit 255 + cp -rpv docs/* "${JPROJECTS_HOME}/${project}/docs/" || exit 255 cd "${JPROJECTS_HOME}/${project}" echo "$0: git add ..." git add docs || exit 255 diff --git a/dist.sh b/dist.sh index 101a0f4..54fcb45 100755 --- a/dist.sh +++ b/dist.sh @@ -24,6 +24,9 @@ GLASSFISH_SSH_PATH="/var/payara/domains/domain1/lib" # Remote SSH server (password-less access) GLASSFISH_SSH_SERVER="www.mxchange.org" +# Windows personal domain +PERSONAL_DOMAIN_PATH="${HOME}/personal_domain/lib" + # Generate list LIST=`find ../*/lib/${NAME}.jar` LIST="${LIST} `find ../*/*-ejb/lib/${NAME}.jar`" @@ -35,6 +38,12 @@ then LIST="${LIST} ${GLASSFISH_BASE_PATH}" fi +if [ -d "${PERSONAL_DOMAIN_PATH}" ] +then + echo "$0: Personal domain found, adding to LIST ..." + LIST="${LIST} ${PERSONAL_DOMAIN_PATH}" +fi + if [ ! -f "${DIST}" ] then echo "$0: '${DIST}' not found." @@ -48,16 +57,16 @@ then mkdir -vp "${WILDFLY_MODULE_PATH}" fi -for target in ${LIST}; +for project in ${LIST}; do - if [ -d "${target}" ] + if [ -d "${project}" ] then - cp -v "${DIST}" "${target}" - elif [ -f "${target}" ] + cp -v "${DIST}" "${project}" + elif [ -f "${project}" ] then - cp -v "${DIST}" "${target}" + cp -v "${DIST}" "${project}" else - echo "$0: Target '${target}' not found." + echo "$0: Project '${project}' not found." fi done diff --git a/pull-stick.sh b/pull-stick.sh index 7f87871..bca9694 100755 --- a/pull-stick.sh +++ b/pull-stick.sh @@ -2,18 +2,23 @@ . ./.jprojects.sh || exit 255 -for ENTRY in ${LIST}; do - cd "${ENTRY}" || exit 255 +for project in ${LIST}; do + if [ ! -d "${JPROJECTS_HOME}/${project}" ] + then + echo "$0: Project '${project}' does not exist." + continue; + fi + + cd "${JPROJECTS_HOME}/${project}" || exit 255 if [ "$1" = "c" ] then - echo "$0: Checkout '${ENTRY}' ..." + echo "$0: Checkout '${project}' ..." git checkout -- . fi - echo "$0: Pulling '${ENTRY}' ..." + echo "$0: Pulling '${project}' ..." git pull transport master || exit 255 - echo "$0: Rebasing '${ENTRY}' ..." + echo "$0: Rebasing '${project}' ..." git rebase origin/master || exit 255 - cd - done diff --git a/push-stick.sh b/push-stick.sh index 2fe7e2b..2c6f520 100755 --- a/push-stick.sh +++ b/push-stick.sh @@ -17,6 +17,12 @@ then fi for project in ${LIST}; do + if [ ! -d "${JPROJECTS_HOME}/${project}" ] + then + echo "$0: Project '${project}' does not exist." + continue; + fi + echo "$0: Processing '${project}',mode='$1' ..." cd "${JPROJECTS_HOME}/${project}" || exit 255