summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorYukai Huang2016-10-05 11:21:19 +0800
committerYukai Huang2016-10-05 11:39:45 +0800
commit79f64d0503a77873dddaa307de0f67f83129dc55 (patch)
tree557493261314613a1bc5abd910478179be463ad5 /bin
parent0e63fe1fa0e1cfd4a2bb8d052514e64e762056e5 (diff)
Create bin/setup script
Diffstat (limited to 'bin')
-rwxr-xr-xbin/setup41
1 files changed, 41 insertions, 0 deletions
diff --git a/bin/setup b/bin/setup
new file mode 100755
index 00000000..461acabd
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# run command at repo root
+CURRENT_PATH=$PWD
+cd $(git rev-parse --show-toplevel)
+
+if ! type npm > /dev/null
+then
+ echo "npm is not installed, please install via nvm(recommended) or package manager"
+ echo "setup will not be run"
+ 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"
+cp config.json.example config.json
+cp public/js/common.js.example public/js/common.js
+cp .sequelizerc.example .sequelizerc
+
+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
+- public/js/common.js
+- .sequelizerc
+
+EOF
+
+# change directory back
+cd $CURRENT_PATH