52e2e13d6b701455695ec0f970f356ecc0ea59e2
[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_apps_root "$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 test_or_die "finding and testing app folder"
32
33 # where we expect to find our checkout folder underneath.
34 full_app_dir="$BASE_APPLICATION_PATH/$app_dirname"
35
36 # use our default values for the repository and theme if they're not provided.
37 if [ -z "$repo_name" ]; then
38   repo_name="$app_dirname"
39 fi
40
41 echo "Repository: $repo_name"
42 sep
43
44 # this should set the site_store_path variable if everything goes well.
45 update_repo "$full_app_dir" "$CHECKOUT_DIR_NAME" "$DEFAULT_REPOSITORY_ROOT" "$repo_name"
46 test_or_die "Updating the repository storage directory"
47
48 sep
49
50 update_composer_repository "$site_store_path" 
51
52 sep
53
54 # now finally do the real check-in for our site.
55
56 pushd "$site_store_path" &>/dev/null
57 rcheckin
58
59 sep
60
61 echo "Finished checking in the site at ${app_dirname}."
62