This repository was archived by the owner on Nov 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathconfigure-sandbox
More file actions
executable file
·92 lines (80 loc) · 3.41 KB
/
configure-sandbox
File metadata and controls
executable file
·92 lines (80 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
[ -z "$1" ] && echo "Do not run this script directly. Run dt-configure-sandbox instead." && exit 1
configArg=$1
# argument:
# configure normal configuration mode. Run on a clean install or reconfigure (mode = configure)
# git_hook run from within a git hook (mode = git_hook)
# deploy run from within a deployment (dt-build)
# configureNoAbort configuration mode but don't abort early if there's a build failure (mode = configure)
mode=""
abort_on_fail=1
[ "$1" == "git-hook" ] && mode=git_hook
[ "$1" == "configure" ] && mode=configure
[ "$1" == "install" ] && mode=install
[ "$1" == "reconfigure" ] && mode=reconfigure
[ "$1" == "deploy" ] && mode=deploy
[ "$1" == "configureNoAbort" ] && mode=configure && abort_on_fail=0
[ -z "$mode" ] && echo "Error: bad configure mode" && exit 1
# This script is called as a hook (from dt-configure-sandbox, deployment script, git hook, ...).
# DO NOT CALL IT DIRECTLY.
#
# Place any commands needed to prepare the sandbox for use here. Assume the
# environment is set
cd $CSBE_TOP
[ ! -d .git ] && echo "nothing to configure for a pre-built asset sandbox ($CSBE_TOP/.git not found)" && exit 0
# Install git submodules
[ -f .gitmodules ] && echo "Updating submodules" && git submodule update --init --recursive
# Exmaple: expanding templates
# $DT_TOP/bin/create-file-from-template.py -t $XYZ_SANDBOX/git_project/etc/httpd.conf.template -o $XYZ_SANDBOX/conf/httpd.conf
# If the sandbox uses node, wipe the node_modules and re-install during re-configuration
if [ -f $CSBE_TOP/package.json -a -n "$CSBE_NODE_VER" ]; then
[ -d $CSBE_TOP/node_modules ] && /bin/rm -rf $CSBE_TOP/node_modules
echo "npm install --no-save (from `pwd`)"
npm install --no-save
[ $? -ne 0 ] && echo "npm install failed" && [ $abort_on_fail -eq 1 ] && exit 1
fi
# Optional NPM package integrity check
# To set this integrtity check up, you must manually create (and maintain) a file containing
# a list of packages whenever you make changes:
# cd $CSBE_TOP
# npm ls | grep -v ^CodeStream_Server@ >sandbox/package-versions.txt
#
#
# if [ -f sandbox/package-versions.txt ]; then
# tmpfile=/tmp/junk$$
# npm ls |grep -v ^CodeStream_Server@ >$tmpfile
# x=`diff sandbox/package-versions.txt $tmpfile|wc -l`
# if [ $x -gt 0 ]; then
# echo "***************************************************************************"
# echo " ERROR: package tree looks different than sandbox/package-versions.txt"
# echo "***************************************************************************"
# [ $abort_on_fail -eq 1 ] && exit 1
# else
# echo "Package integrtity check looks good"
# fi
# /bin/rm $tmpfile
# fi
# Add absolute remotes
echo git remote add private [email protected]:teamcodestream/codestream-server-private
git remote add private [email protected]:teamcodestream/codestream-server-private
# Add git hooks as needed
if [ -d "$CSBE_TOP/hooks" ]; then
echo -n "Installing git hooks as sym links"
cd $CSBE_TOP/.git/hooks
for hook in post-checkout post-merge post-rewrite
do
if [ -f $CSBE_TOP/hooks/$hook ]; then
echo -n "...$hook"
/bin/rm -f $hook
ln -sf ../../hooks/$hook
fi
done
echo "."
fi
# load sub-sandbox
cd $CS_API_TOP && npm install --no-save
cd $CS_BROADCASTER_TOP && npm install --no-save
cd $CS_MAILIN_TOP && npm install --no-save
cd $CS_OUTBOUND_EMAIL_TOP && npm install --no-save
# You must exit with a status of '0' if the script was successful or '1' otherwise.
exit 0