distmaker - Extract functions dm_install_drupal() and dm_install_drupal_info()
authortotten@civicrm.org <Tim Otten>
Sat, 21 Jun 2014 10:33:10 +0000 (03:33 -0700)
committertotten@civicrm.org <Tim Otten>
Sun, 22 Jun 2014 07:54:55 +0000 (00:54 -0700)
distmaker/dists/common.sh
distmaker/dists/drupal6_php5.sh
distmaker/dists/drupal_php5.sh
distmaker/dists/drupal_sk_php5.sh

index d0ff853c98e6275172c7e8b12d53646d005cc099..2de8538c7fc6b42a42c2dc079ababd1865fb0aca 100644 (file)
@@ -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 <drupal_repo_path> <to_path>
+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 <to_path>
+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
+}
index 5894991c73018bc22ee69a63b625c353523feca0..9dda882aee23ce890638b6a65e6f78115a9baeef 100755 (executable)
@@ -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
index 73a3fc548635d3d812c2748fc8b68a12b8363556..a50221d9778a07656db09b87103e29d168821edf 100755 (executable)
@@ -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 "<?php
 function civicrmVersion( ) {
@@ -67,6 +52,7 @@ function civicrmVersion( ) {
 
 # gen tarball
 cd $TRG/..
+
 tar czf $DM_TARGETDIR/civicrm-$DM_VERSION-drupal.tar.gz civicrm
 
 # clean up
index f52f282f3c24974c102ea15a0ada1745d26c0b40..29a7bd825d2fea715ce68dbeddbd5357fa4d2792 100755 (executable)
@@ -35,10 +35,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"
 
 # delete packages that distributions on Drupal.org repalce if present
 # also delete stuff that we dont really use and should not be included