1336a891917b6871f3bb6f3150311203dcf597af
[feisty_meow.git] / scripts / site_avenger / sitepush.sh
1 #!/bin/bash
2
3 # Author: Kevin Wentworth
4 # Author: Chris Koeritz
5
6 # checks the chosen site into the online git repository.
7
8 export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )"  # obtain the script's working directory.
9
10 ############################
11
12 # main body of script.
13
14 # check for parameters.
15 app_dirname="$1"; shift
16 repo_name="$1"; shift
17
18 source "$WORKDIR/shared_site_mgr.sh"
19
20 sep
21
22 check_application_dir "$BASE_APPLICATION_PATH"
23
24 # find proper webroot where the site will be initialized.
25 if [ -z "$app_dirname" ]; then
26   # no dir was passed, so guess it.
27   find_app_folder "$BASE_APPLICATION_PATH"
28 else
29   test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
30 fi
31
32 # where we expect to find our checkout folder underneath.
33 full_app_dir="$BASE_APPLICATION_PATH/$app_dirname"
34
35 # use our default values for the repository and theme if they're not provided.
36 if [ -z "$repo_name" ]; then
37   repo_name="$app_dirname"
38 fi
39
40 echo "Repository: $repo_name"
41 sep
42
43 # this should set the site_store_path variable if everything goes well.
44 update_repo "$full_app_dir" "$CHECKOUT_DIR_NAME" "$DEFAULT_REPOSITORY_ROOT" "$repo_name"
45 test_or_die "Updating the repository storage directory"
46
47 sep
48
49 update_composer_repository "$site_store_path" 
50
51 sep
52
53 # now finally do the real check-in for our site.
54
55 pushd "$site_store_path" &>/dev/null
56 rcheckin
57
58 sep
59
60 echo "Finished checking in the site at ${app_dirname}."
61