refactored to make next refactoring easier
[feisty_meow.git] / scripts / site_avenger / avcoreup.sh
1 #!/bin/bash
2
3 # Author: Kevin Wentworth
4 # Author: Chris Koeritz
5
6 # updates just the site avenger core portion of an app.
7
8 export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )"  # obtain the script's working directory.
9 source "$WORKDIR/shared_site_mgr.sh"
10
11 ############################
12
13 # main body of script.
14
15 # check for parameters.
16 app_dirname="$1"; shift
17
18 sep
19
20 check_application_dir "$APPLICATION_DIR"
21
22 # find proper webroot where the site will be initialized.
23 if [ -z "$app_dirname" ]; then
24   # no dir was passed, so guess it.
25   find_app_folder "$APPLICATION_DIR"
26 else
27   test_app_folder "$APPLICATION_DIR" "$app_dirname"
28 fi
29
30 # where we expect to find our checkout folder underneath.
31 full_app_dir="$APPLICATION_DIR/$app_dirname"
32
33 # simplistic approach here; just go to the folder and pull the changes.
34
35 pushd "$full_app_dir" &>/dev/null
36 test_or_die "Changing to app path '$full_app_dir'"
37
38 dir="avenger5/vendor/siteavenger/avcore"
39 if [ ! -d $dir ]; then
40   echo "The application doesn't seem to use avcore: $full_app_dir"
41 else
42   pushd "$dir" &>/dev/null
43
44   git pull
45   test_or_die "Pulling git repo for avcore under '$full_app_dir'"
46
47   echo "Finished updating the avcore portion of site in ${app_dirname}."
48
49   popd &>/dev/null
50 fi
51
52 popd &>/dev/null
53
54 sep
55