From 006e39e117356655c6724d83c8e32344b6fc68b8 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 11 Dec 2017 21:17:03 -0800 Subject: [PATCH] CRM-16421 - distmaker - Set version in WP zip files --- distmaker/dists/common.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/distmaker/dists/common.sh b/distmaker/dists/common.sh index 23f75d844e..fcacc27409 100644 --- a/distmaker/dists/common.sh +++ b/distmaker/dists/common.sh @@ -193,6 +193,8 @@ function dm_install_wordpress() { --exclude=civicrm \ "$repo/./" "$to/./" ## Need --exclude=civicrm for self-building on WP site + + dm_preg_edit '/^Version: [0-9\.]+/m' "Version: $DM_VERSION" "$to/civicrm.php" } @@ -239,3 +241,12 @@ function dm_git_checkout() { git checkout "$2" popd } + +## Edit a file by applying a regular expression. +## Note: We'd rather just call "sed", but it differs on GNU+BSD. +## usage: dm_preg_edit +## example: '/version = \([0-9]*\.x-\)[1-9.]*/' 'version = \1$DM_VERSION' +function dm_preg_edit() { + env RPAT="$1" RREPL="$2" RFILE="$3" \ + php -r '$c = file_get_contents(getenv("RFILE")); $c = preg_replace(getenv("RPAT"), getenv("RREPL"), $c); file_put_contents(getenv("RFILE"), $c);' +} -- 2.25.1