963586925af436eb48c74226cf15d0b6ce9602a2
[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 source "$WORKDIR/shared_site_mgr.sh"
10
11 # get our defaults.
12 source "$WORKDIR/site_avenger.config"
13
14 ############################
15
16 # main body of script.
17
18 # check for parameters.
19 app_dirname="$1"; shift
20 repo_name="$1"; shift
21
22 sep
23
24 check_application_dir "$APPLICATION_DIR"
25
26 # find proper webroot where the site will be initialized.
27 if [ -z "$app_dirname" ]; then
28   # no dir was passed, so guess it.
29   find_app_folder "$APPLICATION_DIR"
30 else
31   test_app_folder "$APPLICATION_DIR" "$app_dirname"
32 fi
33
34 # where we expect to find our checkout folder underneath.
35 full_app_dir="$APPLICATION_DIR/$app_dirname"
36
37 # use our default values for the repository and theme if they're not provided.
38 if [ -z "$repo_name" ]; then
39   repo_name="$app_dirname"
40 fi
41
42 echo "Repository: $repo_name"
43 sep
44
45 # this should set the site_store_path variable if everything goes well.
46 update_repo "$full_app_dir" "$CHECKOUT_DIR_NAME" "$DEFAULT_REPOSITORY_ROOT" "$repo_name"
47 test_or_die "Updating the repository storage directory"
48
49 sep
50
51 update_composer_repository "$site_store_path" 
52
53 sep
54
55 # now finally do the real check-in for our site.
56
57 pushd "$site_store_path" &>/dev/null
58 rcheckin
59
60 sep
61
62 echo "Finished checking in the site at ${app_dirname}."
63