3 # Author: Chris Koeritz
5 # This is the full orchestrator for bringing up a web site using our site
6 # management scripts. So far, the scripts rely on at least php. The support
7 # is much more powerful if the site is based on cakephp and site avenger.
9 export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
11 source "$WORKDIR/shared_site_mgr.sh"
13 ############################
15 function print_instructions()
18 echo "$(basename $0 .sh) {app name}"
21 app name: The app name parameter is mandatory. The configuration file for
22 this script will be derived from the app name (e.g. if the app name is MyApp,
23 then the config file will be 'MyApp.config'). The config files are by
24 convention stored in the 'config' directory. The configuration file can be
25 overridden by setting the SITE_MANAGEMENT_CONFIG_FILE environment variable."
29 ############################
31 # main body of script.
33 # check for parameters.
34 app_dirname="$1"; shift
36 theme_name="$1"; shift
38 if [ "$app_dirname" == "-help" -o "$app_dirname" == "--help" ]; then
44 check_application_dir "$APPLICATION_DIR"
46 # find proper webroot where the site will be initialized.
47 if [ -z "$app_dirname" ]; then
48 # no dir was passed, so guess it.
49 find_app_folder "$APPLICATION_DIR"
51 test_app_folder "$APPLICATION_DIR" "$app_dirname"
54 # where we expect to find our checkout folder underneath.
55 full_app_dir="$APPLICATION_DIR/$app_dirname"
57 # use our default values for the repository and theme if they're not provided.
58 if [ -z "$repo_name" ]; then
59 repo_name="$app_dirname"
61 if [ -z "$theme_name" ]; then
62 theme_name="$(capitalize_first_char ${app_dirname})"
65 echo "Repository: $repo_name"
66 echo "Theme name: $theme_name"
69 # this should set the site_store_path variable if everything goes well.
70 update_repo "$full_app_dir" "$CHECKOUT_DIR_NAME" "$DEFAULT_REPOSITORY_ROOT" "$repo_name"
71 test_or_die "Updating the repository storage directory"
73 # update the site to load dependencies.
75 composer_repuff "$site_store_path"
76 test_or_die "Installing site dependencies with composer"
78 # set up the symbolic links needed to achieve siteliness.
81 create_site_links "$site_store_path" "$theme_name"
85 echo "Finished powering up the site in '${app_dirname}'."