summaryrefslogtreecommitdiff
path: root/bin/setup
diff options
context:
space:
mode:
authorMax Wu2016-10-05 14:21:03 +0800
committerGitHub2016-10-05 14:21:03 +0800
commit4f16a26fcc88585e003a0956cbce79f756c48bd4 (patch)
tree582b3611a91f0ad40e4c77078e6f17d7d1ac1377 /bin/setup
parentf4d4eb1681f44066c8c648565dbd4b62513e00c0 (diff)
parentec8fb1931b38008e9a434244819c46d866448af3 (diff)
Merge pull request #190 from Yukaii/setup-script
Setup script for getting started
Diffstat (limited to 'bin/setup')
-rwxr-xr-xbin/setup52
1 files changed, 52 insertions, 0 deletions
diff --git a/bin/setup b/bin/setup
new file mode 100755
index 00000000..66279e81
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,52 @@
+#!/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
+ 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"
+if [ ! -f config.json ]; then
+ cp config.json.example config.json
+fi
+
+if [ ! -f publis/js/common.js ]; then
+ cp public/js/common.js.example public/js/common.js
+fi
+
+if [ ! -f .sequelizerc ]; then
+ cp .sequelizerc.example .sequelizerc
+fi
+
+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
+
+* config.json -- server config
+* public/js/common.js -- client config
+* .sequelizerc -- db config
+
+EOF
+
+# change directory back
+cd $CURRENT_PATH