]> git.mxchange.org Git - jcontacts-core.git/blob - dist.sh
updated dist.sh as jratecalc is not a public project
[jcontacts-core.git] / dist.sh
1 #!/bin/bash
2
3 # Name of this project, detected by it's base path
4 NAME="${PWD##*/}"
5
6 # Generated JAR file
7 DIST="dist/${NAME}.jar"
8
9 # WildFly module base path
10 WILDFLY_MODULE_BASE_PATH="${HOME}/wildfly_domain/modules/org/mxchange"
11
12 # And for this "module" (as WildFly calls it)
13 WILDFLY_MODULE_PATH="${WILDFLY_MODULE_BASE_PATH}/${NAME}/main"
14
15 # module.xml
16 WILDFLY_MODULE_XML_FILE="wildfly/module.xml"
17
18 # Glassfish base path (domain)
19 GLASSFISH_BASE_PATH="${HOME}/gf_domain/domain/lib"
20
21 # Remote Glassfish path
22 GLASSFISH_SSH_PATH="/var/payara/domains/domain1/lib"
23
24 # Remote SSH server (password-less access)
25 GLASSFISH_SSH_SERVER="www.mxchange.org"
26
27 # Generate list
28 LIST=`find ../*/lib/${NAME}.jar`
29 LIST="${LIST} `find ../*/*-ejb/lib/${NAME}.jar`"
30 LIST="${LIST} ${WILDFLY_MODULE_PATH}"
31
32 if [ -d "${GLASSFISH_BASE_PATH}" ]
33 then
34         echo "$0: Glassfish personal domain found, adding to LIST ..."
35         LIST="${LIST} ${GLASSFISH_BASE_PATH}"
36 fi
37
38 if [ ! -f "${DIST}" ]
39 then
40         echo "$0: '${DIST}' not found."
41         exit 1
42 elif [ ! -d "${WILDFLY_MODULE_BASE_PATH}" ]
43 then
44         echo "$0: WildFly base path '${WILDFLY_MODULE_BASE_PATH}' not created."
45         exit 1
46 elif [ ! -d "${WILDFLY_MODULE_PATH}" ]
47 then
48         mkdir -vp "${WILDFLY_MODULE_PATH}"
49 fi
50
51 for target in ${LIST};
52 do
53         if [ -d "${target}" ]
54         then
55                 cp -v "${DIST}" "${target}"
56         elif [ -f "${target}" ]
57         then
58                 cp -v "${DIST}" "${target}"
59         else
60                 echo "$0: Target '${target}' not found."
61         fi
62
63 done
64
65 # Testing on project name
66 SKIP_TEST="${NAME:0:9}"
67
68 if [ -n "${GLASSFISH_SSH_PATH}" -a -n "${GLASSFISH_SSH_SERVER}" -a "${SKIP_TEST}" != "jratecalc" ]
69 then
70         echo "$0: Copying to remote '${GLASSFISH_SSH_SERVER}' ..."
71         scp "${DIST}" "${GLASSFISH_SSH_SERVER}:${GLASSFISH_SSH_PATH}"
72 fi
73
74 # Copy module.xml ...
75 if [ -f "${WILDFLY_MODULE_XML_FILE}" ]
76 then
77         echo "$0: Generating module.xml ..."
78         XML_CONTENT=`cat "${WILDFLY_MODULE_XML_FILE}"`
79         XML_CONTENT="${XML_CONTENT//NAME/$NAME}"
80         echo "${XML_CONTENT}" > "${WILDFLY_MODULE_PATH}/module.xml"
81 fi
82
83 echo "$0: All done."
84 exit 0