2020-03-04 03:33:38 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-11-09 10:05:29 +00:00
|
|
|
set -e
|
|
|
|
|
2020-03-04 03:33:38 +00:00
|
|
|
APP_NAME=${1}
|
|
|
|
APP_REPO=${2}
|
|
|
|
APP_BRANCH=${3}
|
2021-06-08 10:31:08 +00:00
|
|
|
FRAPPE_BRANCH=${4}
|
2020-03-04 03:33:38 +00:00
|
|
|
|
2020-03-07 00:03:32 +00:00
|
|
|
[ "${APP_BRANCH}" ] && BRANCH="-b ${APP_BRANCH}"
|
2020-03-04 03:33:38 +00:00
|
|
|
|
2021-11-09 23:13:46 +00:00
|
|
|
mkdir -p /home/frappe/frappe-bench
|
2020-03-04 03:33:38 +00:00
|
|
|
cd /home/frappe/frappe-bench
|
2021-11-09 23:13:46 +00:00
|
|
|
mkdir -p apps "sites/assets/${APP_NAME}"
|
|
|
|
echo -ne "frappe\n${APP_NAME}" >sites/apps.txt
|
2020-03-04 03:33:38 +00:00
|
|
|
|
2021-11-09 23:13:46 +00:00
|
|
|
git clone --depth 1 -b "${FRAPPE_BRANCH}" https://github.com/frappe/frappe apps/frappe
|
2021-11-09 10:05:29 +00:00
|
|
|
# shellcheck disable=SC2086
|
2021-11-09 23:13:46 +00:00
|
|
|
git clone --depth 1 ${BRANCH} ${APP_REPO} apps/${APP_NAME}
|
2020-03-04 03:33:38 +00:00
|
|
|
|
2021-02-21 02:08:18 +00:00
|
|
|
echo "Install frappe NodeJS dependencies . . ."
|
2021-11-09 23:13:46 +00:00
|
|
|
cd apps/frappe
|
|
|
|
yarn --pure-lockfile
|
|
|
|
|
2021-02-21 02:08:18 +00:00
|
|
|
echo "Install ${APP_NAME} NodeJS dependencies . . ."
|
2021-11-09 23:13:46 +00:00
|
|
|
yarn --pure-lockfile --cwd "../${APP_NAME}"
|
|
|
|
|
|
|
|
echo "Build ${APP_NAME} assets . . ."
|
2021-11-09 10:05:29 +00:00
|
|
|
yarn production --app "${APP_NAME}"
|
2020-03-04 03:33:38 +00:00
|
|
|
|
2021-11-09 23:13:46 +00:00
|
|
|
cd /home/frappe/frappe-bench
|
2021-11-09 10:05:29 +00:00
|
|
|
# shellcheck disable=SC2086
|
2021-11-09 23:13:46 +00:00
|
|
|
cp -R apps/${APP_NAME}/${APP_NAME}/public/* sites/assets/${APP_NAME}
|
2020-03-04 03:33:38 +00:00
|
|
|
|
2020-07-10 17:45:36 +00:00
|
|
|
# Add frappe and all the apps available under in frappe-bench here
|
2021-06-23 03:43:24 +00:00
|
|
|
echo "rsync -a --delete /var/www/html/assets/frappe /assets" >/rsync
|
|
|
|
echo "rsync -a --delete /var/www/html/assets/${APP_NAME} /assets" >>/rsync
|
2020-03-19 23:51:30 +00:00
|
|
|
chmod +x /rsync
|
2020-03-05 02:28:42 +00:00
|
|
|
|
2021-11-09 23:13:46 +00:00
|
|
|
rm sites/apps.txt
|