distmaker - Extract function dm_generate_version()
authortotten@civicrm.org <Tim Otten>
Sat, 21 Jun 2014 10:41:52 +0000 (03:41 -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
distmaker/dists/joomla_php5.sh
distmaker/dists/wordpress_php5.sh

index 2de8538c7fc6b42a42c2dc079ababd1865fb0aca..7af818fdb901a163fd22599ffcb9b76d378ac9d7 100644 (file)
@@ -111,3 +111,19 @@ function dm_install_drupal_info() {
     fi
   done
 }
+
+## Generate civicrm-version.php
+## usage: dm_generate_version <file> <ufname>
+function dm_generate_version() {
+  local to="$1"
+  local ufname="$2"
+
+  # final touch
+  echo "<?php
+function civicrmVersion( ) {
+  return array( 'version'  => '$DM_VERSION',
+                'cms'      => '$ufname',
+                'revision' => '$DM_REVISION' );
+}
+" > "$to"
+}
index 9dda882aee23ce890638b6a65e6f78115a9baeef..8ccec51bfbee1ab005de845005d832b6de2bc6c0 100755 (executable)
@@ -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 "<?php
-function civicrmVersion( ) {
-  return array( 'version'  => '$DM_VERSION',
-                'cms'      => 'Drupal6',
-                'revision' => '$DM_REVISION' );
-}
-" > $TRG/civicrm-version.php
+dm_generate_version "$TRG/civicrm-version.php" Drupal6
 
 # gen tarball
 cd $TRG/..
index a50221d9778a07656db09b87103e29d168821edf..c656c86814fd5c67c62510688a1359a392fc0c65 100755 (executable)
@@ -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 "<?php
-function civicrmVersion( ) {
-  return array( 'version'  => '$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
index 29a7bd825d2fea715ce68dbeddbd5357fa4d2792..b1c6ee2c6a1b2e2943957a65dbfc7c227c856b9a 100755 (executable)
@@ -49,15 +49,7 @@ rm -rf $TRG/WordPress
 
 # copy docs
 cp $SRC/drupal/civicrm.config.php.drupal $TRG/civicrm.config.php
-
-# final touch
-echo "<?php
-function civicrmVersion( ) {
-  return array( 'version'  => '$DM_VERSION',
-                'cms'      => 'Drupal',
-                'revision' => '$DM_REVISION' );
-}
-" > $TRG/civicrm-version.php
+dm_generate_version "$TRG/civicrm-version.php" Drupal
 
 # gen tarball
 cd $TRG/..
index 4e75cbc684a6760f75dff78944e5522525d23f40..cd84ac9c80cc61c6e0ead9807934b4a34469bd88 100755 (executable)
@@ -42,15 +42,7 @@ done
 
 # copy docs
 cp $SRC/civicrm.config.php $TRG
-
-# final touch
-echo "<?php
-function civicrmVersion( ) {
-  return array( 'version'  => '$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;
index 4f62656b7947dcce2fec9a58cf9e82ec1c88d715..ddb19bf99ce863179d862beb08ae5aa834652701 100644 (file)
@@ -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 "<?php
-function civicrmVersion( ) {
-  return array( 'version'  => '$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