4 EXTROOT
=$
(cd `dirname $0`/..
; pwd)
5 EXTKEY
="org.civicrm.afform-html"
7 ##############################
9 echo "usage: $0 [options]"
11 echo " -h (Help) Show this help screen"
12 echo " -D (Download) Download dependencies"
13 echo " -z (Zip) Build installable ZIP file"
16 ##############################
17 function use_civiroot
() {
18 if [ -z "$CIVIROOT" ]; then
19 CIVIROOT
=$
(cv ev
'echo $GLOBALS["civicrm_root"];')
20 if [ -z "$CIVIROOT" -o ! -d "$CIVIROOT" ]; then
23 echo "ERROR: invalid civicrm-dir: [$CIVIROOT]"
29 ##############################
32 ## No DAOs or XML build to cleanup
35 ##############################
36 function do_download
() {
37 pushd "$EXTROOT" >> /dev
/null
42 ##############################
43 ## Build installable ZIP file
44 function do_zipfile
() {
45 local canary
="$EXTROOT/node_modules/monaco-editor/package.json"
46 if [ ! -f "$canary" ]; then
47 echo "Error: File $canary missing. Are you sure the build is ready?"
51 local zipfile
="$EXTROOT/build/$EXTKEY.zip"
52 [ -f "$zipfile" ] && rm -f "$zipfile"
53 [ ! -d "$EXTROOT/build" ] && mkdir
"$EXTROOT/build"
54 pushd "$EXTROOT" >> /dev
/null
55 ## Build a list of files to include.
56 ## Put the files into the *.zip, using a $EXTKEY as a prefix.
58 ## Get any files in the project root, except for dotfiles.
59 find .
-mindepth 1 -maxdepth 1 -type f
-o -type d |
grep -v '^\./\.'
60 ## Get any files in the main subfolders.
61 #find CRM/ ang/ api/ bin/ css/ js/ sql/ sass/ settings/ templates/ tests/ xml/ -type f -o -type d
62 find bin
/ xml
/ -type f
-o -type d
63 ## Get the distributable files for Monaco.
64 find node_modules
/monaco-editor
/LICENSE node_modules
/monaco-editor
/min
-type f
-o -type d
67 | php bin
/add-zip-regex.php
"$zipfile" ":^:" "$EXTKEY/"
69 echo "Created: $zipfile"
72 ##############################
76 while getopts "aDghz" opt
; do
92 echo "Invalid option: -$OPTARG" >&2
96 echo "Option -$OPTARG requires an argument." >&2
102 if [ -z "$HAS_ACTION" ]; then