Created
November 11, 2012 11:12
-
-
Save surjikal/4054605 to your computer and use it in GitHub Desktop.
Fetch client-side dependencies for a static site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
LIBS_DIR="./src/scripts/libs" | |
COLOR_RED="\033[0;31m" | |
COLOR_PURPLE="\033[0;35m" | |
COLOR_BRIGHT_PURPLE="\033[1;35m" | |
COLOR_GREEN="\033[0;32m" | |
COLOR_RESET="\033[0m" | |
function fetch { | |
filename=$1; url=$2 | |
printf "$COLOR_PURPLE+ $COLOR_BRIGHT_PURPLE%-26s$COLOR_RESET " $filename | |
wget --timeout 2 --tries 1 -O "$LIBS_DIR/$filename" $url 2> /dev/null | |
if [ $? -ne 0 ]; then | |
printf "$COLOR_RED%s$COLOR_RESET\n" '✗' | |
else | |
printf "$COLOR_GREEN%s$COLOR_RESET\n" '✓' | |
fi | |
} | |
# Removing existing libs... | |
rm $LIBS_DIR/*.js > /dev/null | |
fetch 'zepto.js' http://zeptojs.com/zepto.js | |
fetch 'jquery.js' https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.2/jquery.js | |
fetch 'jquery.cookie.js' https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js | |
fetch 'jquery.base64.js' https://raw.github.com/carlo/jquery-base64/master/jquery.base64.js | |
fetch 'lodash.js' https://raw.github.com/bestiejs/lodash/v0.9.0/lodash.js | |
fetch 'backbone.js' http://backbonejs.org/backbone.js | |
fetch 'backbone.layoutmanager.js' https://raw.github.com/tbranyen/backbone.layoutmanager/master/backbone.layoutmanager.js | |
fetch 'backbone.statemachine.js' https://raw.github.com/sebpiq/backbone.statemachine/master/backbone.statemachine.js | |
fetch 'backbone.relational.js' https://raw.github.com/PaulUithol/Backbone-relational/master/backbone-relational.js | |
fetch 'handlebars.runtime.js' http://cloud.github.com/downloads/wycats/handlebars.js/handlebars.runtime-1.0.rc.1.js | |
fetch 'backbone.queryparams.js' https://raw.github.com/jhudson8/backbone-query-parameters/master/backbone.queryparams.js | |
fetch 'spin.js' http://fgnass.github.com/spin.js/dist/spin.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment