anything-scripts

Disposable scripts to fix day to day problems.
git clone git://soucy.cc/anything-scripts.git
Log | Files | Refs

manuelfile (1876B)


      1 #!/usr/bin/env bash
      2 
      3 # Dependencies :
      4 # - https://github.com/ShaneKilkelly/manuel
      5 # - https://github.com/ShaneKilkelly/manuel-contrib-watch
      6 
      7 # $HOME/.manuel.d/plugins/manuel-contrib-watch
      8 load_plugin manuel-contrib-watch
      9 
     10 # Paths vars
     11 FERRON_PATH=/home/hs0ucy/_01_http/ferron
     12 
     13 SITE_PATH=/home/hs0ucy/_01_http/ferron/sites/hugo.soucy.cc
     14 SITE_DOMAINNAME="hugo.soucy.cc"
     15 SITE_PUBLIC_HTML=public_html
     16 SITE_STATIC_DST=static/dst
     17 SITE_STATIC_SRC=static/src
     18 SITE_TEMPLATES=templates
     19 
     20 # Update partials/cv.mustache
     21 function updatecv () {
     22     # from git@github.com:hs0ucy/Curriculum-vitae.git repository
     23     curl https://raw.githubusercontent.com/hs0ucy/Curriculum-vitae/master/curriculum-vitae.html > "$SITE_TEMPLATES/partials/cv.mustache"
     24 }
     25 
     26 # Concatenate and minify assets
     27 # Then build the static site
     28 function build () {
     29     updatecv &&
     30 
     31     ./preprocess_css
     32     ./preprocess_javascript
     33 
     34     case $1 in
     35         -d|--dev)
     36             cd "$FERRON_PATH" &&
     37             ./cornelius build --dev
     38             ;;
     39         *)
     40             cd "$FERRON_PATH" &&
     41             ./cornelius build
     42             ;;
     43     esac
     44 
     45     echo "- $SITE_DOMAINNAME is builded!"
     46 }
     47 
     48 # Build the static site
     49 # Then deploy it to the web server
     50 function deploy () {
     51     build &&
     52 
     53      cd $SITE_PATH
     54 
     55     ./deploy
     56 
     57     echo "- ... and deployed!"
     58 }
     59 
     60 # Concatenate and minify stylesheets
     61 # Then export with rsync
     62 function update_css () {
     63     ./preprocess_css &&
     64 
     65     rsync -avmh "$SITE_STATIC_DST/css/" "$SITE_PUBLIC_HTML/css/"
     66 }
     67 
     68 # Concatenate and minify scripts
     69 # Then export with rsync
     70 function update_js () {
     71     ./preprocess_javascript &&
     72 
     73     rsync -avmh "$SITE_STATIC_DST/js/" "$SITE_PUBLIC_HTML/js/"
     74 }
     75 
     76 # Watch CSS and JS files
     77 # Then update them
     78 function watch_assets_change () {
     79 
     80     declare -A actions=(
     81         ["*?css"]="update_css"
     82         ["*?js"]="update_js"
     83     )
     84 
     85     manuel_watch "$SITE_STATIC_SRC/"
     86 }