HackMD/bin/setup

53 lines
1 KiB
Plaintext
Raw Normal View History

2016-10-05 03:21:19 +00:00
#!/bin/bash
# run command at repo root
CURRENT_PATH=$PWD
cd $(git rev-parse --show-toplevel)
if ! type npm > /dev/null
then
cat << EOF
npm is not installed, please install Node.js and npm.
Read more on Node.js official website: https://nodejs.org
Setup will not be run
EOF
2016-10-05 03:21:19 +00:00
exit 0
fi
if ! type bower > /dev/null
then
echo "bower is not installed, install via npm"
npm install -g bower
fi
echo "copy config files"
2016-10-05 04:12:21 +00:00
if [ ! -f config.json ]; then
cp config.json.example config.json
fi
if [ ! -f publis/js/config.js ]; then
cp public/js/config.js.example public/js/config.js
2016-10-05 04:12:21 +00:00
fi
if [ ! -f .sequelizerc ]; then
cp .sequelizerc.example .sequelizerc
fi
2016-10-05 03:21:19 +00:00
echo "install npm and bower packages"
npm install && bower install
cat << EOF
Edit the following config file to setup hackmd server and client.
Read more info at https://github.com/hackmdio/hackmd#configuration-files
2016-10-05 04:07:07 +00:00
* config.json -- server config
* public/js/config.js -- client config
2016-10-05 04:07:07 +00:00
* .sequelizerc -- db config
2016-10-05 03:21:19 +00:00
EOF
# change directory back
cd $CURRENT_PATH