Skip to content
Snippets Groups Projects
Commit 1fe0e278 authored by totten's avatar totten
Browse files

gitify - Extract helpers, do_gencode and config_repo

parent 2dd6dd94
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,24 @@ function do_svnify() {
svn co "$REPO" "$TGT"
}
## usage: do_gencode <civicrm-path>
function do_gencode() {
pushd "$1/xml" > /dev/null
if [ -f "GenCode.php" ]; then
echo "[[Generate files]]"
php GenCode.php
else
echo "[[Skip \"Generate files\"]]"
fi
popd > /dev/null
}
## config_repo <repo-name> <local-path> <default-branch> <git-scripts-path>
function config_repo() {
do_gitify "${GIT_BASE_URL}/${1}.git" "$2" -b "$3"
do_hookify "$1" "$2" "$4"
}
function check_dep() {
if [ -z "`which git`" ]; then
echo "command not found: git"
......@@ -84,7 +102,7 @@ function check_dep() {
fi
}
#### Main ####
#### Main: Parse arguments ####
set -e
......@@ -141,35 +159,29 @@ if [ -z "$CIVICRM_ROOT" -o ! -d "$CIVICRM_ROOT" -o -z "$GIT_BASE_URL" -o -z "$CI
exit 1
fi
#### Main: Update git repo metadata ####
check_dep
do_gitify "${GIT_BASE_URL}/civicrm-core.git" "$CIVICRM_ROOT" -b "${CIVICRM_BRANCH}"
do_hookify civicrm-core "$CIVICRM_ROOT" "../tools/scripts/git"
do_gitify "${GIT_BASE_URL}/civicrm-packages.git" "$CIVICRM_ROOT/packages" -b "${CIVICRM_BRANCH}"
do_hookify civicrm-packages "$CIVICRM_ROOT/packages" "../../tools/scripts/git"
## config_repo <repo-name> <local-path> <default-branch> <git-scripts-path>
config_repo civicrm-core "$CIVICRM_ROOT" "$CIVICRM_BRANCH" "../tools/scripts/git"
config_repo civicrm-packages "$CIVICRM_ROOT/packages" "$CIVICRM_BRANCH" "../../tools/scripts/git"
case "$CIVICRM_CMS" in
Drupal)
do_gitify "${GIT_BASE_URL}/civicrm-drupal.git" "$CIVICRM_ROOT/drupal" -b "7.x-${CIVICRM_BRANCH}"
do_hookify civicrm-drupal "$CIVICRM_ROOT/drupal" "../../tools/scripts/git"
config_repo civicrm-drupal "$CIVICRM_ROOT/drupal" "7.x-$CIVICRM_BRANCH" "../../tools/scripts/git"
;;
Drupal6)
do_gitify "${GIT_BASE_URL}/civicrm-drupal.git" "$CIVICRM_ROOT/drupal" -b "6.x-${CIVICRM_BRANCH}"
do_hookify civicrm-drupal "$CIVICRM_ROOT/drupal" "../../tools/scripts/git"
config_repo civicrm-drupal "$CIVICRM_ROOT/drupal" "6.x-$CIVICRM_BRANCH" "../../tools/scripts/git"
;;
Joomla)
do_gitify "${GIT_BASE_URL}/civicrm-joomla.git" "$CIVICRM_ROOT/joomla" -b "${CIVICRM_BRANCH}"
do_hookify civicrm-joomla "$CIVICRM_ROOT/joomla" "../../tools/scripts/git"
config_repo civicrm-joomla "$CIVICRM_ROOT/joomla" "$CIVICRM_BRANCH" "../../tools/scripts/git"
;;
WordPress)
do_gitify "${GIT_BASE_URL}/civicrm-wordpress.git" "$CIVICRM_ROOT/WordPress" -b "${CIVICRM_BRANCH}"
do_hookify civicrm-wordpress "$CIVICRM_ROOT/WordPress" "../../tools/scripts/git"
config_repo civicrm-wordpress "$CIVICRM_ROOT/WordPress" "$CIVICRM_BRANCH" "../../tools/scripts/git"
;;
all)
do_gitify "${GIT_BASE_URL}/civicrm-drupal.git" "$CIVICRM_ROOT/drupal" -b "7.x-${CIVICRM_BRANCH}"
do_hookify civicrm-drupal "$CIVICRM_ROOT/drupal" "../../tools/scripts/git"
do_gitify "${GIT_BASE_URL}/civicrm-joomla.git" "$CIVICRM_ROOT/joomla" -b "${CIVICRM_BRANCH}"
do_hookify civicrm-joomla "$CIVICRM_ROOT/joomla" "../../tools/scripts/git"
do_gitify "${GIT_BASE_URL}/civicrm-wordpress.git" "$CIVICRM_ROOT/WordPress" -b "${CIVICRM_BRANCH}"
do_hookify civicrm-wordpress "$CIVICRM_ROOT/WordPress" "../../tools/scripts/git"
config_repo civicrm-drupal "$CIVICRM_ROOT/drupal" "7.x-$CIVICRM_BRANCH" "../../tools/scripts/git"
config_repo civicrm-joomla "$CIVICRM_ROOT/joomla" "$CIVICRM_BRANCH" "../../tools/scripts/git"
config_repo civicrm-wordpress "$CIVICRM_ROOT/WordPress" "$CIVICRM_BRANCH" "../../tools/scripts/git"
;;
*)
echo "Unrecognized CMS: $CIVICRM_CMS"
......@@ -179,11 +191,4 @@ if [ "$CIVICRM_L10N" == "--l10n" ]; then
do_svnify "http://svn.civicrm.org/l10n/trunk" "$CIVICRM_ROOT/l10n"
fi
pushd "$CIVICRM_ROOT/xml" > /dev/null
if [ -f "GenCode.php" ]; then
echo "[[Generate files]]"
php GenCode.php
else
echo "[[Skip \"Generate files\"]]"
fi
popd > /dev/null
do_gencode "$CIVICRM_ROOT"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment