3 # Author: Kevin Wentworth
4 # Author: Chris Koeritz
6 # checks the chosen site into the online git repository.
8 export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
9 source "$WORKDIR/shared_site_mgr.sh"
12 source "$WORKDIR/site_avenger.config"
14 ############################
16 # main body of script.
18 # check for parameters.
19 app_dirname="$1"; shift
24 check_application_dir "$APPLICATION_DIR"
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"
31 test_app_folder "$APPLICATION_DIR" "$app_dirname"
34 # where we expect to find our checkout folder underneath.
35 full_app_dir="$APPLICATION_DIR/$app_dirname"
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"
42 echo "Repository: $repo_name"
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 check_result "Updating the repository storage directory"
51 update_composer_repository "$site_store_path"
55 # now finally do the real check-in for our site.
57 pushd "$site_store_path" &>/dev/null
62 echo "Finished checking in the site at ${app_dirname}."
69 echo bailing before deprecated code is run.; exit 0
72 # see if there are any unmerged files, if so, do not try to push files
73 if [[ `git ls-files -u` ]]; then
74 echo "Git: local changes!"
75 echo "Aborting. Please resolve manually and re-run this script"
77 # http://stackoverflow.com/questions/5143795/how-can-i-check-in-a-bash-script-if-my-local-git-repo-has-changes
78 # see if there are any new files that need pushing (status will show new files)
79 if [[ `git status --porcelain` ]]; then
82 git commit -m "SERVER. Adding user uploaded files. [via sitepush]"
83 git push origin master
84 echo "Git: changes pushed to [master]"
87 echo "Git: nothing to push. [master] up to date."