X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=bin%2Fgitify;h=dc2b93dbb92f590ccf9c2a4ff535b03d347c3771;hb=12f92dbdabcb07b7e872c0279d82036dee119187;hp=3b9d4535ab2775660b74b6401533705ba3550b31;hpb=639a47e989e0b5b12be546d93f99ec0571f887ee;p=civicrm-core.git diff --git a/bin/gitify b/bin/gitify index 3b9d4535ab..dc2b93dbb9 100755 --- a/bin/gitify +++ b/bin/gitify @@ -73,22 +73,31 @@ function git_set_remote() { } ########################################### -## usage: do_svnify -function do_svnify() { - REPO="$1" - TGT="$2" - shift 2 +## usage: do_targzify +## Fetches a tar.gz archive and unpacks it in the current directory +function do_targzify() { + TARGZURL="$1" + TARFILE="$2" + TGT="$3" + shift 3 - if [ -d "$TGT/.svn" ]; then - echo "[[Already checked out SVN repo ($TGT) -- skip $REPO]]" + if [ -d "$TGT" ]; then + echo "[[Already have a copy of the archive ($TGT) -- skip $TARGZURL]]" return fi - [ -d $TGT ] || mkdir -p "$TGT" - [ -d $TMP ] && rm -rf "$TMP" - echo "[[Checkout $REPO ($TMP)]]" - echo "[svn co \"$REPO\" \"$TGT\"]" - svn co "$REPO" "$TGT" + TMP=`mktemp -d` + + echo "[[Downloading $TARGZURL ($TMP)]]" + echo "[wget \"$TARGZURL\" -O \"$TMP/$TARFILE\"]" + + pushd "$CIVICRM_ROOT" > /dev/null + wget -q "$TARGZURL" -O "$TMP/$TARFILE" + tar zxfv "$TMP/$TARFILE" + popd + + rm "$TMP/$TARFILE" + rmdir "$TMP" } ########################################### @@ -104,6 +113,35 @@ function do_gencode() { popd > /dev/null } +## usage: do_setupconf +function do_setupconf() { + pushd "$1" >> /dev/null + echo "[[Initialize bin/setup.conf]]" + if [ ! -f "bin/setup.conf" ]; then + pwd + echo cp "bin/setup.conf.txt" "bin/setup.conf" + cp "bin/setup.conf.txt" "bin/setup.conf" + fi + echo "[[chmod 600 bin/setup.conf]]" + chmod 600 bin/setup.conf + echo "" + echo "====================[ Next steps (for Civi v4.6+) ]====================" + echo " * Edit the following file and fill in credentials for the CiviCRM DB." + echo " $1/bin/setup.conf" + echo " * Perform one of these steps:" + echo " + Run 'bin/setup.sh -Dg' to download and generate missing code." + echo " + Run 'bin/setup.sh' to download code and reset the CiviCRM DB" + echo " with the latest schema." + echo " * If this is a network-accessible server (eg staging/production), then" + echo " setup.conf may present a security issue. The permissions have been" + echo " preset to restrict access in most servers - but this may not work" + echo " in all environments. Please:" + echo " + Check whether the file is web-accessible." + echo " + Optionally, change the permissions." + echo " + Optionally, delete the file." + popd > /dev/null +} + ########################################### ## config_repo ## 1 2 3 4 @@ -141,6 +179,7 @@ CIVICRM_GIT_HOOKS="" CIVICRM_BRANCH="master" FORK_GIT_BASE_URL="" UPSTREAM_GIT_BASE_URL="https://github.com/civicrm" +SKIP_GENCODE= while [ -n "$1" ]; do if [ "$1" == "--l10n" ]; then @@ -153,6 +192,11 @@ while [ -n "$1" ]; do elif [ "$1" == "--fork" ]; then shift FORK_GIT_BASE_URL="$1" + elif [ "$1" == "--skip-gencode" ]; then + SKIP_GENCODE=1 + elif [ "$1" == "--branch" ]; then + shift + CIVICRM_BRANCH="$1" elif [ -z "$CIVICRM_CMS" ]; then ## First arg CIVICRM_CMS="$1" @@ -168,19 +212,22 @@ done if [ -z "$CIVICRM_ROOT" -o ! -d "$CIVICRM_ROOT" -o -z "$UPSTREAM_GIT_BASE_URL" -o -z "$CIVICRM_CMS" ]; then echo "Convert a directory into a set of CiviCRM git clones" - echo "usage: $0 [--fork ] [--upstream ] [--l10n] [--hooks]" + echo "usage: $0 [--fork ] [--upstream ] [--l10n] [--hooks] [--branch ]" echo " : one of: Drupal|Drupal6|Joomla|WordPress|all" echo " : a base URL shared by the desiried git repos (e.g. git://github.com/civicrm)" echo " : the main directory containing CiviCRM" echo " --upstream : specify the base URL for upstream repositories" echo " --fork : specify the base URL for your personal fork repositories" - echo " --l10n: optionally fetch localization data; currently requires svn" + echo " --l10n: optionally fetch localization data" echo " --hooks: optionally install recommended git hooks; the hooks are mostly" echo " tested with git CLI under Linux and OSX; they haven't been" echo " tested with git GUIs or Windows" + echo " --branch : specy the base branch name to checkout (ex: 'master', '4.4')" + echo " For some repos, this name is adapted (ex: Drupal's '7.x-master' or '6.x-master'" + echo " --skip-gencode: optionally disable gencode execution" echo "" echo "Note: If pointing to a pre-existing directory, your local changes may be replaced by" - echo "the pristine code from git/svn. If you've made changes, then make sure there's a backup!" + echo "the pristine code from git. If you've made changes, then make sure there's a backup!" echo "" echo "example: $0 Drupal /var/www/drupal7/sites/all/modules/civicrm" echo " (checkout core code plus Drupal 7.x integration code)" @@ -218,12 +265,19 @@ case "$CIVICRM_CMS" in config_repo civicrm-joomla "$CIVICRM_ROOT/joomla" "$CIVICRM_BRANCH" "../../tools/scripts/git" config_repo civicrm-wordpress "$CIVICRM_ROOT/WordPress" "$CIVICRM_BRANCH" "../../tools/scripts/git" ;; + none) + ;; *) echo "Unrecognized CMS: $CIVICRM_CMS" esac if [ "$CIVICRM_L10N" == "--l10n" ]; then - do_svnify "http://svn.civicrm.org/l10n/trunk" "$CIVICRM_ROOT/l10n" + do_targzify "https://download.civicrm.org/civicrm-l10n-core/archives/civicrm-l10n-daily.tar.gz" "civicrm-l10n-daily.tar.gz" "$CIVICRM_ROOT/l10n" fi -do_gencode "$CIVICRM_ROOT" +if [ -f "$CIVICRM_ROOT/composer.json" ]; then + ## Civi v4.6+ + do_setupconf "$CIVICRM_ROOT" +elif [ -z "$SKIP_GENCODE" ]; then + do_gencode "$CIVICRM_ROOT" +fi