From 72dbdcb5d2f13e191184603236b9c3765c578746 Mon Sep 17 00:00:00 2001 From: Hadrien Mary Date: Mon, 26 Oct 2015 10:13:59 +0100 Subject: [PATCH] Add build bash script. Close #27 --- Dockerfile | 0 make_butter.sh | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 Dockerfile create mode 100755 make_butter.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e69de29 diff --git a/make_butter.sh b/make_butter.sh new file mode 100755 index 0000000..46eba9b --- /dev/null +++ b/make_butter.sh @@ -0,0 +1,84 @@ +#!/bin/sh + +## Version 0.2 +## +## Usage +## ./make_butter.sh [url] +## +## The script make_butter.sh allows you to setup, and build a version of Butter + +execsudo() { + case $OSTYPE in msys*) + echo $OSTYPE + $1 + ;; + *) + sudo $1 + ;; + esac +} + +try="True" +tries=0 +while [ "$try" = "True" ]; do + read -p "Do you wish to install the required dependencies for Butter and setup for building? (yes/no) [default is yes] " rd_dep + if [ -z "$rd_dep" ]; then + rd_dep="yes" + fi + tries=$((tries+1)) + if [ "$rd_dep" = "yes" ] || [ "$rd_dep" = "no" ]; then + try="False" + elif [ "$tries" -ge "3" ]; then + echo "No valid input, exiting" + exit 3 + else + echo "Not a valid answer, please try again" + fi +done + +if [ "$rd_dep" = "yes" ]; then + echo "Installing global dependencies" + if execsudo "npm install -g bower grunt-cli"; then + echo "Global dependencies installed successfully." + else + echo "Global dependencies encountered an error while installing" + echo "************************************************************************" + echo "* Global dependencies encountered an error while installing *" + echo "* Please report your issue providing the output at : *" + echo "* https://github.com/butterproject/butter-desktop-angular/issues *" + echo "************************************************************************" + exit 4 + fi + + echo "Installing local dependencies" + if npm install; then + echo "Local dependencies installed successfully." + else + echo "************************************************************************" + echo "* Local dependencies encountered an error while installing *" + echo "* Please report your issue providing the output at : *" + echo "* https://github.com/butterproject/butter-desktop-angular/issues *" + echo "************************************************************************" + exit 4 + fi + + echo "Successfully setup for Butter" +fi + +echo "Building grunt" +if grunt build; then + echo "************************************************************************" + echo "* Butter built successfully. *" + echo "* - Run 'grunt start' from inside the repository to launch the app *" + echo "* - Run 'grunt dev' if you want butter to reload when the source code *" + echo " is modified. *" + echo "* Enjoy. *" + echo "************************************************************************" +else + echo "************************************************************************" + echo "* Butter encountered an error and couldn't be built *" + echo "* Please report your issue providing the output at : *" + echo "* https://github.com/butterproject/butter-desktop-angular/issues *" + echo "************************************************************************" + exit 5 +fi