From 7082ee3c2f4802de6467ba6620dc3ab89d2a19c5 Mon Sep 17 00:00:00 2001 From: "totten@civicrm.org" Date: Sat, 21 Jun 2014 03:33:10 -0700 Subject: [PATCH] distmaker - Extract functions dm_install_drupal() and dm_install_drupal_info() --- distmaker/dists/common.sh | 33 +++++++++++++++++++++++++++++++ distmaker/dists/drupal6_php5.sh | 5 +---- distmaker/dists/drupal_php5.sh | 20 +++---------------- distmaker/dists/drupal_sk_php5.sh | 5 +---- 4 files changed, 38 insertions(+), 25 deletions(-) diff --git a/distmaker/dists/common.sh b/distmaker/dists/common.sh index d0ff853c98..2de8538c7f 100644 --- a/distmaker/dists/common.sh +++ b/distmaker/dists/common.sh @@ -78,3 +78,36 @@ function dm_install_packages() { [ ! -d "$to" ] && mkdir "$to" rsync -avC $excludes_rsync --include=core "$repo/./" "$to/./" } + +## Copy Drupal-integration module +## usage: dm_install_drupal +function dm_install_drupal() { + local repo="$1" + local to="$2" + + local excludes_rsync="" + for exclude in .git .svn ; do + excludes_rsync="--exclude=${exclude} ${excludes_rsync}" + done + + [ ! -d "$to" ] && mkdir "$to" + rsync -avC $excludes_rsync "$repo/./" "$to/./" +} + +## TODO: Merge this into dm_install_drupal; use on all Drupal releases +## usage: dm_install_drupal_info +function dm_install_drupal_info() { + local to="$1" + + # set full version in .info files + local MODULE_DIRS=`find "$to" -type f -name "*.info"` + for INFO in $MODULE_DIRS; do + if [ $(uname) = "Darwin" ]; then + ## BSD sed + sed -i '' "s/version = [1-9.]*/version = $DM_VERSION/g" $INFO + else + ## GNU sed + sed -i'' "s/version = [1-9.]*/version = $DM_VERSION/g" $INFO + fi + done +} diff --git a/distmaker/dists/drupal6_php5.sh b/distmaker/dists/drupal6_php5.sh index 5894991c73..9dda882aee 100755 --- a/distmaker/dists/drupal6_php5.sh +++ b/distmaker/dists/drupal6_php5.sh @@ -37,10 +37,7 @@ fi # copy all the stuff dm_install_core "$SRC" "$TRG" dm_install_packages "$SRC/packages" "$TRG/packages" -for CODE in drupal; do - echo $CODE - [ -d $SRC/$CODE ] && $RSYNCCOMMAND $SRC/$CODE $TRG -done +dm_install_drupal "$SRC/drupal" "$TRG/drupal" # copy docs cp $SRC/drupal/civicrm.config.php.drupal $TRG/civicrm.config.php diff --git a/distmaker/dists/drupal_php5.sh b/distmaker/dists/drupal_php5.sh index 73a3fc5486..a50221d977 100755 --- a/distmaker/dists/drupal_php5.sh +++ b/distmaker/dists/drupal_php5.sh @@ -36,26 +36,11 @@ fi # copy all the stuff dm_install_core "$SRC" "$TRG" dm_install_packages "$SRC/packages" "$TRG/packages" -for CODE in drupal; do - echo $CODE - [ -d $SRC/$CODE ] && $RSYNCCOMMAND $SRC/$CODE $TRG -done +dm_install_drupal "$SRC/drupal" "$TRG/drupal" +dm_install_drupal_info "$DM_SOURCEDIR/drupal" cp $SRC/drupal/civicrm.config.php.drupal $TRG/civicrm.config.php -# set full version in .info files -MODULE_DIRS=`find "$DM_SOURCEDIR/drupal" -type f -name "*.info"` -for INFO in $MODULE_DIRS; do - if [ $(uname) = "Darwin" ]; then - ## BSD sed - sed -i '' "s/version = [1-9.]*/version = $DM_VERSION/g" $INFO - else - ## GNU sed - sed -i'' "s/version = [1-9.]*/version = $DM_VERSION/g" $INFO - fi -done - - # final touch echo "