From 79f64d0503a77873dddaa307de0f67f83129dc55 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 5 Oct 2016 11:21:19 +0800 Subject: Create bin/setup script --- bin/setup | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 bin/setup (limited to 'bin/setup') 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 -- cgit v1.2.3 From 5dfa83d350d38991ebaf12f0890bd91f726c670d Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 5 Oct 2016 12:07:07 +0800 Subject: Update config description --- bin/setup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin/setup') diff --git a/bin/setup b/bin/setup index 461acabd..c29117af 100755 --- a/bin/setup +++ b/bin/setup @@ -31,9 +31,9 @@ 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 +* config.json -- server config +* public/js/common.js -- client config +* .sequelizerc -- db config EOF -- cgit v1.2.3 From 934ed7c0d97958118b79e6c3da35fd1fae6b8e17 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 5 Oct 2016 12:12:21 +0800 Subject: Copy config only when file not exist --- bin/setup | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'bin/setup') diff --git a/bin/setup b/bin/setup index c29117af..f0d860dc 100755 --- a/bin/setup +++ b/bin/setup @@ -18,9 +18,17 @@ then 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 +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 -- cgit v1.2.3 From 69c14a274df76f9cba566c67a8721e737c69c2f4 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 5 Oct 2016 14:09:39 +0800 Subject: Do not recommend anything in setup script --- bin/setup | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bin/setup') diff --git a/bin/setup b/bin/setup index f0d860dc..66279e81 100755 --- a/bin/setup +++ b/bin/setup @@ -6,8 +6,11 @@ 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" + 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 -- cgit v1.2.3