Revision: 45794
Updated Code
at May 9, 2011 14:15 by mecha
Updated Code
#!/bin/bash # ------------------------------------------------------------ # Bash script I run on my web server thats updates commonly # used JavaScript libs. Easy enough to follow and customize if # need be. # # * Be sure to modify JS_LIBS_DIR (Root save path). # # - /jquery/jquery.js|jquery.min.js # - /headjs/headjs.js|head.min.js|head.load.min.js # - /misc/css_browser_selector.js # - /misc/modernizr.js # - /mobile/redirection_mobile.js|redirection_mobile.min.js|redirection_mobile_self.js|redirection_mobile_self.min.js # - /jquery/plugins/jquery.cookie.js # - /misc/respond.src.js|respond.min.js # # @author Jon LaBelle, jonlabelle.com # @date May 8, 2011 # # CRON SCHEDULE (Weekly on Sunday at 1:55 AM) # 55 1 * * 0 /home/cronjobs/weekly/get-latest-javascript-libs.sh # ------------------------------------------------------------ CURL_USER_AGENT="Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)" # user agent for curl = Windows OS, MS Internet Explorer 7 JS_LIBS_DIR="/home/content/html/js/libs" # Root save path function download_file() { # curl ops: silent, insecure, redirects, file output curl -s -k -l -o $1 -A '$CURL_USER_AGENT' $2; echo "`pwd`/$1 - UPDATED!" } function unzip_file() { # unzip ops: overwrite without prompting, quiet mode unzip -o -q $1; } function update_jquery() { JQUERY_LATEST_URL="http://code.jquery.com/jquery-latest.js" JQUERY_LATEST_MIN_URL="http://code.jquery.com/jquery-latest.min.js" cd $JS_LIBS_DIR/jquery; download_file jquery.js $JQUERY_LATEST_URL; download_file jquery.min.js $JQUERY_LATEST_MIN_URL; } function update_headjs() { HEADJS_LATEST_URL="https://github.com/headjs/headjs/raw/master/dist/head.js" HEADJS_MIN_URL="https://github.com/headjs/headjs/raw/master/dist/head.min.js" HEADJS_LOAD_MIN_URL="https://github.com/headjs/headjs/raw/master/dist/head.load.min.js" cd $JS_LIBS_DIR/headjs; download_file head.js $HEADJS_LATEST_URL; download_file head.min.js $HEADJS_MIN_URL; download_file head.load.min.js $HEADJS_LOAD_MIN_URL; } function update_css_browser_selector() { CSS_BROWSER_SELECTOR_LATEST_URL="https://github.com/rafaelp/css_browser_selector/raw/master/css_browser_selector.js" cd $JS_LIBS_DIR/misc; download_file css_browser_selector.js $CSS_BROWSER_SELECTOR_LATEST_URL; } function update_modernizr() { MODERNIZR_LATEST_URL="https://github.com/Modernizr/Modernizr/raw/master/modernizr.js" cd $JS_LIBS_DIR/misc; download_file modernizr.js $MODERNIZR_LATEST_URL; } function update_redirection_mobile() { REDIRECTION_MOBILE_LATEST_URL="https://github.com/sebarmeli/JS-Redirection-Mobile-Site/raw/master/redirection_mobile.js" REDIRECTION_MOBILE_MIN_URL="https://github.com/sebarmeli/JS-Redirection-Mobile-Site/raw/master/redirection_mobile.min.js" REDIRECTION_MOBILE_SELF_URL="https://github.com/sebarmeli/JS-Redirection-Mobile-Site/raw/master/redirection_mobile_self.js" REDIRECTION_MOBILE_SELF_MIN_URL="https://github.com/sebarmeli/JS-Redirection-Mobile-Site/raw/master/redirection_mobile_self.min.js" cd $JS_LIBS_DIR/mobile; download_file redirection_mobile.js $REDIRECTION_MOBILE_LATEST_URL; download_file redirection_mobile.min.js $REDIRECTION_MOBILE_MIN_URL; download_file redirection_mobile_self.js $REDIRECTION_MOBILE_SELF_URL; download_file redirection_mobile_self.min.js $REDIRECTION_MOBILE_SELF_MIN_URL; } function update_jquery_cookie() { JQUERY_COOKIE_LATEST_URL="https://github.com/carhartl/jquery-cookie/raw/master/jquery.cookie.js" cd $JS_LIBS_DIR/jquery/plugins; download_file jquery.cookie.js $JQUERY_COOKIE_LATEST_URL; } function update_respond() { RESPOND_LATEST_URL="https://github.com/scottjehl/Respond/raw/master/respond.src.js" RESPOND_MIN_URL="https://github.com/scottjehl/Respond/raw/master/respond.min.js" cd $JS_LIBS_DIR/misc; download_file respond.js $RESPOND_LATEST_URL; download_file respond.min.js $RESPOND_MIN_URL; } update_jquery update_headjs update_css_browser_selector update_modernizr update_redirection_mobile update_jquery_cookie update_respond exit
Revision: 45793
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 8, 2011 11:05 by mecha
Initial Code
#!/bin/bash # ------------------------------------------------------------ # Bash script I run on my web server that updates commonly # used JavaScript libs. Easy enough to follow and customize if # need be. # # * Be sure to modify JS_LIBS_DIR (Root save path). # # - /jquery/jquery.js|jquery.min.js # - /headjs/headjs.js|head.min.js # - /misc/css_browser_selector.js # - /misc/modernizr.js # - /mobile/redirection_mobile.js|redirection_mobile.min.js|redirection_mobile_self.js|redirection_mobile_self.min.js # # @author Jon LaBelle, jonlabelle.com # @date May 7, 2011 # # CRON SCHEDULE (Weekly on Sunday at 1:55 AM) # 55 1 * * 0 /users/jon/cronjobs/weekly/get-latest-javascript-libs.sh # ------------------------------------------------------------ CURL_USER_AGENT="Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)" # user agent for curl = Windows OS, MS Internet Explorer 7 JS_LIBS_DIR="/www/shared/js/libs" # Root save path function download_file() { # curl ops: silent, insecure, redirects, file output curl -s -k -l -o $1 -A '$CURL_USER_AGENT' $2 } function update_jquery() { JQUERY_LATEST_URL="http://code.jquery.com/jquery-latest.js" JQUERY_LATEST_MIN_URL="http://code.jquery.com/jquery-latest.min.js" cd $JS_LIBS_DIR/jquery; download_file jquery.js $JQUERY_LATEST_URL; download_file jquery.min.js $JQUERY_LATEST_MIN_URL; echo "jquery updated!" } function update_headjs() { HEADJS_LATEST_URL="https://github.com/headjs/headjs/raw/master/dist/head.js" HEADJS_MIN_URL="https://github.com/headjs/headjs/raw/master/dist/head.min.js" HEADJS_LOAD_MIN_URL="https://github.com/headjs/headjs/raw/master/dist/head.load.min.js" cd $JS_LIBS_DIR/headjs; download_file head.js $HEADJS_LATEST_URL; download_file head.min.js $HEADJS_MIN_URL; download_file head.load.min.js $HEADJS_LOAD_MIN_URL; echo "headjs updated!" } function update_css_browser_selector() { CSS_BROWSER_SELECTOR_LATEST_URL="https://github.com/rafaelp/css_browser_selector/raw/master/css_browser_selector.js" cd $JS_LIBS_DIR/misc; download_file css_browser_selector.js $CSS_BROWSER_SELECTOR_LATEST_URL; echo "css browser selector updated!" } function update_modernizr() { MODERNIZR_LATEST_URL="https://github.com/Modernizr/Modernizr/raw/master/modernizr.js" cd $JS_LIBS_DIR/misc; download_file modernizr.js $MODERNIZR_LATEST_URL; echo "modernizr updated!" } function update_redirection_mobile() { REDIRECTION_MOBILE_LATEST_URL="https://github.com/sebarmeli/JS-Redirection-Mobile-Site/raw/master/redirection_mobile.js" REDIRECTION_MOBILE_MIN_URL="https://github.com/sebarmeli/JS-Redirection-Mobile-Site/raw/master/redirection_mobile.min.js" REDIRECTION_MOBILE_SELF_URL="https://github.com/sebarmeli/JS-Redirection-Mobile-Site/raw/master/redirection_mobile_self.js" REDIRECTION_MOBILE_SELF_MIN_URL="https://github.com/sebarmeli/JS-Redirection-Mobile-Site/raw/master/redirection_mobile_self.min.js" cd $JS_LIBS_DIR/mobile; download_file redirection_mobile.js $REDIRECTION_MOBILE_LATEST_URL; download_file redirection_mobile.min.js $REDIRECTION_MOBILE_MIN_URL; download_file redirection_mobile_self.js $REDIRECTION_MOBILE_SELF_URL; download_file redirection_mobile_self.min.js $REDIRECTION_MOBILE_SELF_MIN_URL; echo "redirection mobile updated!" } update_jquery update_headjs update_css_browser_selector update_modernizr update_redirection_mobile
Initial URL
Initial Description
Initial Title
Bash script to update common JavaScript libraries (jQuery, headjs, modernizr, etc.)
Initial Tags
javascript, Bash, script
Initial Language
Bash