#!/bin/bash | |
# ================================================== | |
# GrowControl - Workspace setup script | |
# | |
# This script downloads and prepares the GrowControl | |
# source code workspace. The project uses the | |
# pxnCommon library as a source of common code. | |
# | |
# http://GrowControl.com | |
# https://github.com/PoiXson/GrowControl | |
# ================================================== | |
# getgc.sh - http://dl.growcontrol.com/getgc.sh | |
clear | |
# Contents of http://dl.growcontrol.com | |
#<FilesMatch "getgc.sh"> | |
# AddHandler application/x-httpd-php5 .sh | |
#</FilesMatch> | |
# | |
#<?php | |
#//echo "<pre>\n\n"; | |
#//print_r($_SERVER); | |
# | |
#$gist = 'https://gist.github.com/lorenzop/ef0496ccc483e81834cf'; | |
#$gist_raw = 'https://gist.githubusercontent.com/lorenzop/ef0496ccc483e81834cf/raw/getgc.sh'; | |
# | |
#$agent = @$_SERVER['HTTP_USER_AGENT']; | |
#$agent = strtolower($agent); | |
#if( 'curl' == substr($agent, 0, 4) || 'wget' == substr($agent, 0, 4) ) { | |
# header('Location:'.$gist_raw); | |
#} else { | |
# header('Location:'.$gist); | |
#} | |
gitPrefix="https://github.com/GrowControl/" | |
#gitPrefix="git@github.com:GrowControl/" | |
# load common utils script | |
if [ -e "${PWD}/common.sh" ]; then | |
source "${PWD}/common.sh" | |
elif [ -e "/usr/bin/shellscripts/common.sh" ]; then | |
source "/usr/bin/shellscripts/common.sh" | |
else | |
wget -O "${PWD}/common.sh" "https://raw.githubusercontent.com/PoiXson/shellscripts/master/pxn/common.sh" \ | |
|| exit 1 | |
source "${PWD}/common.sh" | |
fi | |
# ================================================== | |
function doClone { | |
local repoName="$1" | |
local gitPath="${gitPrefix}${repoName}.git" | |
newline | |
if [ -d "${PWD}/${repoName}/" ]; then | |
echo "Pulling ${repoName} .." | |
pushd "${PWD}/${repoName}/" || exit 1 | |
git pull || exit 1 | |
popd | |
else | |
echo "Cloning ${repoName} .." | |
git clone "${gitPath}" || exit 1 | |
fi | |
newline | |
} | |
function doBuild { | |
local repoName="$1" | |
echo "Building ${repoName} .." | |
newline | |
pushd "${PWD}/${repoName}" || exit 1 | |
gradle --daemon cleanEclipse eclipse || exit 1 | |
gradle --daemon || exit 1 | |
popd | |
newline | |
} | |
title "Pulling from repo.." | |
doClone "pxnCommon" | |
doClone "GrowControl" | |
doClone "gcStudio" | |
doClone "gcLab" | |
doClone "ArduinoGC" | |
doClone "gcTimer" | |
doClone "gcSequencer" | |
doClone "ExamplePlugin" | |
title "Building.." | |
doBuild "pxnCommon" | |
doBuild "GrowControl/common" | |
doBuild "GrowControl/api" | |
doBuild "GrowControl/server" | |
doBuild "gcStudio" | |
doBuild "gcLab" | |
doBuild "ArduinoGC/plugin" | |
doBuild "gcTimer" | |
doBuild "gcSequencer" | |
doBuild "ExamplePlugin" | |
title "Success!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment