summaryrefslogtreecommitdiff
path: root/bin/setup
blob: 66279e816644aeccfb4483cba1f70fe8167835b3 (plain)
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
#!/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