From 30a50cd8d8a13e9024cb0ff537fa45ef1f9904e9 Mon Sep 17 00:00:00 2001 From: "totten@civicrm.org" Date: Sat, 21 Jun 2014 03:41:52 -0700 Subject: [PATCH] distmaker - Extract function dm_generate_version() --- distmaker/dists/common.sh | 16 ++++++++++++++++ distmaker/dists/drupal6_php5.sh | 10 +--------- distmaker/dists/drupal_php5.sh | 11 +---------- distmaker/dists/drupal_sk_php5.sh | 10 +--------- distmaker/dists/joomla_php5.sh | 10 +--------- distmaker/dists/wordpress_php5.sh | 10 +--------- 6 files changed, 21 insertions(+), 46 deletions(-) diff --git a/distmaker/dists/common.sh b/distmaker/dists/common.sh index 2de8538c7f..7af818fdb9 100644 --- a/distmaker/dists/common.sh +++ b/distmaker/dists/common.sh @@ -111,3 +111,19 @@ function dm_install_drupal_info() { fi done } + +## Generate civicrm-version.php +## usage: dm_generate_version +function dm_generate_version() { + local to="$1" + local ufname="$2" + + # final touch + echo " '$DM_VERSION', + 'cms' => '$ufname', + 'revision' => '$DM_REVISION' ); +} +" > "$to" +} diff --git a/distmaker/dists/drupal6_php5.sh b/distmaker/dists/drupal6_php5.sh index 9dda882aee..8ccec51bfb 100755 --- a/distmaker/dists/drupal6_php5.sh +++ b/distmaker/dists/drupal6_php5.sh @@ -41,15 +41,7 @@ dm_install_drupal "$SRC/drupal" "$TRG/drupal" # copy docs cp $SRC/drupal/civicrm.config.php.drupal $TRG/civicrm.config.php - -# final touch -echo " '$DM_VERSION', - 'cms' => 'Drupal6', - 'revision' => '$DM_REVISION' ); -} -" > $TRG/civicrm-version.php +dm_generate_version "$TRG/civicrm-version.php" Drupal6 # gen tarball cd $TRG/.. diff --git a/distmaker/dists/drupal_php5.sh b/distmaker/dists/drupal_php5.sh index a50221d977..c656c86814 100755 --- a/distmaker/dists/drupal_php5.sh +++ b/distmaker/dists/drupal_php5.sh @@ -40,19 +40,10 @@ 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 - -# final touch -echo " '$DM_VERSION', - 'cms' => 'Drupal', - 'revision' => '$DM_REVISION' ); -} -" > $TRG/civicrm-version.php +dm_generate_version "$TRG/civicrm-version.php" Drupal # gen tarball cd $TRG/.. - tar czf $DM_TARGETDIR/civicrm-$DM_VERSION-drupal.tar.gz civicrm # clean up diff --git a/distmaker/dists/drupal_sk_php5.sh b/distmaker/dists/drupal_sk_php5.sh index 29a7bd825d..b1c6ee2c6a 100755 --- a/distmaker/dists/drupal_sk_php5.sh +++ b/distmaker/dists/drupal_sk_php5.sh @@ -49,15 +49,7 @@ rm -rf $TRG/WordPress # copy docs cp $SRC/drupal/civicrm.config.php.drupal $TRG/civicrm.config.php - -# final touch -echo " '$DM_VERSION', - 'cms' => 'Drupal', - 'revision' => '$DM_REVISION' ); -} -" > $TRG/civicrm-version.php +dm_generate_version "$TRG/civicrm-version.php" Drupal # gen tarball cd $TRG/.. diff --git a/distmaker/dists/joomla_php5.sh b/distmaker/dists/joomla_php5.sh index 4e75cbc684..cd84ac9c80 100755 --- a/distmaker/dists/joomla_php5.sh +++ b/distmaker/dists/joomla_php5.sh @@ -42,15 +42,7 @@ done # copy docs cp $SRC/civicrm.config.php $TRG - -# final touch -echo " '$DM_VERSION', - 'cms' => 'Joomla', - 'revision' => '$DM_REVISION' ); -} -" > $TRG/civicrm-version.php +dm_generate_version "$TRG/civicrm-version.php" Joomla # gen zip file cd $DM_TMPDIR; diff --git a/distmaker/dists/wordpress_php5.sh b/distmaker/dists/wordpress_php5.sh index 4f62656b79..ddb19bf99c 100644 --- a/distmaker/dists/wordpress_php5.sh +++ b/distmaker/dists/wordpress_php5.sh @@ -55,15 +55,7 @@ rm -f $TRG/civicrm/civicrm.config.php.wordpress # copy docs cp $SRC/WordPress/civicrm.config.php.wordpress $TRG/civicrm/civicrm/civicrm.config.php - -# final touch -echo " '$DM_VERSION', - 'cms' => 'Wordpress', - 'revision' => '$DM_REVISION' ); -} -" > $TRG/civicrm/civicrm/civicrm-version.php +dm_generate_version "$TRG/civicrm/civicrm/civicrm-version.php" Wordpress # gen tarball cd $TRG -- 2.25.1