From 63e137556b82cff12359ab127ec3463c27af854d Mon Sep 17 00:00:00 2001 From: Mario Colque Date: Thu, 24 Apr 2014 15:57:45 -0300 Subject: [PATCH] added gh-pages web app generator --- .gitignore | 1 + ghpages.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100755 ghpages.sh diff --git a/.gitignore b/.gitignore index cd2274086..fe7b97bde 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ lib/* js/copayBundle.js config.js +gh-pages diff --git a/ghpages.sh b/ghpages.sh new file mode 100755 index 000000000..0cc140285 --- /dev/null +++ b/ghpages.sh @@ -0,0 +1,44 @@ +#! /bin/bash + +#Description: A simple script to compile and copy only the needed files for the web app. + +# Configs +GHPDIR="gh-pages" +LIBDIR="$GHPDIR/lib" + +OpenColor="\033[" +Red="1;31m" +Yellow="1;33m" +Green="1;32m" +CloseColor="\033[0m" + +# Create/Clean temp dir +echo -e "${OpenColor}${Green}* Checking temp dir...${CloseColor}" +if [ ! -d $GHPDIR ]; then + mkdir $GHPDIR +else + rm -rf $GHPDIR/* +fi + +# Generate and copy bitcore bundle +if [ ! -d node_modules/bitcore ]; then + echo -e "${OpenColor}${Red}X The node_modules/bitcore dir does not exist. \nRun npm install and try again.${CloseColor}" + exit 1 +else + echo -e "${OpenColor}${Green}* Generating bitcore bundle...${CloseColor}" + cd node_modules/bitcore + grunt --target=dev shell + cd ../.. +fi + +# Re-compile copayBundle.js +echo -e "${OpenColor}${Green}* Generating copay bundle...${CloseColor}" +grunt --target=dev shell + +# Copy all app files +echo -e "${OpenColor}${Green}* Copying all app files...${CloseColor}" +cp -af {css,font,img,js,lib,config.js,index.html} $GHPDIR +cp -af node_modules/bitcore/browser/bundle.js $LIBDIR/ +mv $LIBDIR/bundle.js $LIBDIR/bitcore.js + +echo -e "${OpenColor}${Yellow}\nAwesome! You just need to copy and paste the ./gh-pages content to your local repository and push it.${CloseColor}"