CRM-15797 - distmaker - Fixes for JS dependencies:
authorTim Otten <totten@civicrm.org>
Wed, 7 Jan 2015 19:45:48 +0000 (11:45 -0800)
committerTim Otten <totten@civicrm.org>
Wed, 7 Jan 2015 19:58:25 +0000 (11:58 -0800)
 * Exclude node_modules
 * Include bower_components
 * Include .json, composer.lock, bower.json, package.json
 * DM_NPM should be optional

distmaker/distmaker.conf.dist
distmaker/distmaker.sh
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 738812ae14dbc8254e8cd727d20e34284c2dd2d9..a1b4f9b38269228a2609cb9933e76bf5dca4f673 100644 (file)
@@ -4,11 +4,15 @@ DM_GENFILESDIR= <Set this to directory where generated files should reside>
 DM_TMPDIR= <Set this to temporary directory>
 DM_TARGETDIR= <Set this to directory where tarballs should land>
 
-DM_NPM= <Set this to your npm binary>
 DM_PHP= <Set this to your php binary>
 DM_RSYNC= <set this to your rsync binary>
 DM_ZIP= <set this to your zip binary>
 
+## Optional
+# DM_NPM= <Set this to your npm binary> [default: npm]
+# DM_NODE= <Set this to your node binary> [default: node]
+# DM_COMPOSER= <Set this to your composer binary> [default: composer]
+
 DM_VERSION= <Set this to whatever the version number should be>
 
 ## Git banch/tag name
index b3967adc451ffc881521837864ec304bd81adbca..404ad852bb49402770321bef725b5bbf57873e8e 100755 (executable)
@@ -156,9 +156,6 @@ case $1 in
 
 esac
 
-## Install npm packages
-dm_npm_install "$DM_SOURCEDIR"
-
 ## Make sure we have the right branch or tag
 dm_git_checkout "$DM_SOURCEDIR" "$DM_REF_CORE"
 dm_git_checkout "$DM_SOURCEDIR/packages" "$DM_REF_PACKAGES"
@@ -168,6 +165,7 @@ dm_git_checkout "$DM_SOURCEDIR/drupal" "$DM_REF_DRUPAL"
 
 ## Get latest dependencies
 dm_generate_vendor "$DM_SOURCEDIR"
+dm_generate_bower "$DM_SOURCEDIR"
 
 # Before anything - regenerate DAOs
 
index b6bfc6c1865dd27201456692b45899bb37e266a0..b6a4c752f7de5d5309c109cb5a396313d9881272 100644 (file)
@@ -45,17 +45,32 @@ function dm_remove_files() {
   done
 }
 
+## Copy all bower dependencies
+function dm_install_bower() {
+  local repo="$1"
+  local to="$2"
+
+  local excludes_rsync=""
+  for exclude in .git .svn {T,t}est{,s} {D,d}oc{,s} {E,e}xample{,s} ; do
+    excludes_rsync="--exclude=${exclude} ${excludes_rsync}"
+  done
+
+  [ ! -d "$to" ] && mkdir "$to"
+  $DM_RSYNC -avC $excludes_rsync "$repo/./" "$to/./"
+}
+
 ## Copy all core files
 ## usage: dm_install_core <core_repo_path> <to_path>
 function dm_install_core() {
   local repo="$1"
   local to="$2"
 
-  for dir in css i js PEAR templates bin CRM api extern Reports install settings Civi partials node_modules bower_components ; do
+  for dir in css i js PEAR templates bin CRM api extern Reports install settings Civi partials ; do
     [ -d "$repo/$dir" ] && dm_install_dir "$repo/$dir" "$to/$dir"
   done
 
   dm_install_files "$repo" "$to" {agpl-3.0,agpl-3.0.exception,gpl,README,CONTRIBUTORS}.txt
+  dm_install_files "$repo" "$to" composer.json composer.lock bower.json package.json
 
   mkdir -p "$to/sql"
   pushd "$repo" >> /dev/null
@@ -146,13 +161,8 @@ function dm_install_vendor() {
     excludes_rsync="--exclude=${exclude} ${excludes_rsync}"
   done
 
-  ## Note: These small folders have items that previously were not published,
-  ## but there's no real cost to including them, and excluding them seems
-  ## likely to cause confusion as the codebase evolves:
-  ##   packages/Files packages/PHP packages/Text
-
   [ ! -d "$to" ] && mkdir "$to"
-  $DM_RSYNC -avC $excludes_rsync --include=core "$repo/./" "$to/./"
+  $DM_RSYNC -avC $excludes_rsync "$repo/./" "$to/./"
 }
 
 ##  usage: dm_install_wordpress <wp_repo_path> <to_path>
@@ -173,12 +183,23 @@ function dm_install_wordpress() {
   ## Need --exclude=civicrm for self-building on WP site
 }
 
+
+## Generate the "bower_components" folder.
+## usage: dm_generate_bower <repo_path>
+function dm_generate_bower() {
+  local repo="$1"
+  pushd "$repo"
+    ${DM_NPM:-npm} install
+    ${DM_NODE:-node} node_modules/bower/bin/bower install
+  popd
+}
+
 ## Generate the composer "vendor" folder
 ## usage: dm_generate_vendor <repo_path>
 function dm_generate_vendor() {
   local repo="$1"
   pushd "$repo"
-    composer install
+    ${DM_COMPOSER:-composer} install
   popd
 }
 
@@ -206,11 +227,3 @@ function dm_git_checkout() {
     git checkout "$2"
   popd
 }
-
-## Install npm packages
-## usage: dm_npm_install <path>
-function dm_npm_install() {
-  pushd "$1"
-    $DM_NPM install
-  popd
-}
index c6083d846d1cb4ce956b9166e72b6b8c9591d94e..1a7c7c579013336099f87b6d238184580388121f 100755 (executable)
@@ -21,6 +21,7 @@ dm_generate_version "$TRG/civicrm-version.php" Drupal6
 dm_install_core "$SRC" "$TRG"
 dm_install_packages "$SRC/packages" "$TRG/packages"
 dm_install_vendor "$SRC/vendor" "$TRG/vendor"
+dm_install_bower "$SRC/bower_components" "$TRG/bower_components"
 dm_install_drupal "$SRC/drupal" "$TRG/drupal"
 
 # gen tarball
index dd421936eac31dfaf89681712b5107b533294aa6..a090e31fd70b593d358728fb5c70f378f111a35f 100755 (executable)
@@ -21,6 +21,7 @@ dm_generate_version "$TRG/civicrm-version.php" Drupal
 dm_install_core "$SRC" "$TRG"
 dm_install_packages "$SRC/packages" "$TRG/packages"
 dm_install_vendor "$SRC/vendor" "$TRG/vendor"
+dm_install_bower "$SRC/bower_components" "$TRG/bower_components"
 dm_install_drupal "$SRC/drupal" "$TRG/drupal"
 
 # gen tarball
index c35d07b7e8dddacce5adf1ebe66f1d7bf4501f13..6c55a71335682620fd2e9903dd876b86ef89b1e0 100755 (executable)
@@ -21,6 +21,7 @@ dm_generate_version "$TRG/civicrm-version.php" Drupal
 dm_install_core "$SRC" "$TRG"
 dm_install_packages "$SRC/packages" "$TRG/packages"
 dm_install_vendor "$SRC/vendor" "$TRG/vendor"
+dm_install_bower "$SRC/bower_components" "$TRG/bower_components"
 dm_install_drupal "$SRC/drupal" "$TRG/drupal"
 
 # delete packages that distributions on Drupal.org repalce if present
index 08ab281fdc9cf2b038340c762cb2cdd554e694a8..7c1a25b476e09b6576ce8fc81fbc0f7276dd3eee 100755 (executable)
@@ -21,6 +21,7 @@ dm_generate_version "$TRG/civicrm-version.php" Joomla
 dm_install_core "$SRC" "$TRG"
 dm_install_packages "$SRC/packages" "$TRG/packages"
 dm_install_vendor "$SRC/vendor" "$TRG/vendor"
+dm_install_bower "$SRC/bower_components" "$TRG/bower_components"
 
 ## WTF: It's so good we'll install it twice!
 ## (The first is probably extraneous, but there could be bugs dependent on it.)
index 1982e6a4f3d039b69b6de4291cd258d09ecdb2d8..25bff97ff42c2ee4918e02b4d2f48a5eb58cdca8 100644 (file)
@@ -21,6 +21,7 @@ dm_generate_version "$TRG/civicrm/civicrm/civicrm-version.php" Wordpress
 dm_install_core "$SRC" "$TRG/civicrm/civicrm"
 dm_install_packages "$SRC/packages" "$TRG/civicrm/civicrm/packages"
 dm_install_vendor "$SRC/vendor" "$TRG/civicrm/civicrm/vendor"
+dm_install_bower "$SRC/bower_components" "$TRG/civicrm/civicrm/bower_components"
 dm_install_wordpress "$SRC/WordPress" "$TRG/civicrm"
 
 # gen tarball