summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--.sequelizerc.example (renamed from .sequelizerc)0
-rw-r--r--README.md2
-rwxr-xr-xbin/setup52
-rw-r--r--config.json.example (renamed from config.json)2
-rw-r--r--public/js/common.js.example (renamed from public/js/common.js)0
6 files changed, 60 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 794cf9ee..f6c8d5da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,4 +15,9 @@ tmp/
backups/
*.pid
*.log
-*.sqlite \ No newline at end of file
+*.sqlite
+
+# ignore config files
+config.json
+public/js/common.js
+.sequelizerc
diff --git a/.sequelizerc b/.sequelizerc.example
index 29a0d145..29a0d145 100644
--- a/.sequelizerc
+++ b/.sequelizerc.example
diff --git a/README.md b/README.md
index 7e7b1f80..3443e1d5 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ Get started
---
1. Download a release and unzip or clone into a directory
-2. Enter the directory and type `npm install && bower install`, which will install all the dependencies
+2. Enter the directory and type `bin/setup`, which will install npm/bower dependencies and create configs. The setup script is written in Bash, you would need bash as a prerequisite.
3. Setup the configs, see more below
4. Setup environment variables which will overwrite the configs
5. Run the server as you like (node, forever, pm2)
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
diff --git a/config.json b/config.json.example
index 35efcd25..22fd5c92 100644
--- a/config.json
+++ b/config.json.example
@@ -49,4 +49,4 @@
"clientID": "change this"
}
}
-} \ No newline at end of file
+}
diff --git a/public/js/common.js b/public/js/common.js.example
index 11c32acc..11c32acc 100644
--- a/public/js/common.js
+++ b/public/js/common.js.example