setup.sh, npm test - Fix for debian.org's build of nodejs
authorTim Otten <totten@civicrm.org>
Wed, 4 Mar 2015 23:51:25 +0000 (15:51 -0800)
committerTim Otten <totten@civicrm.org>
Wed, 4 Mar 2015 23:57:23 +0000 (15:57 -0800)
Debian renamed "node" to "nodejs" to avoid conflicts with another package.
One can resolve that by installing an extra package ("nodejs-legacy") or by
using the nodesource.com packages, but users may not know that.

https://lists.debian.org/debian-devel-announce/2012/07/msg00002.html

This commit uses whichever command is available.

bin/setup.sh
tools/scripts/npm/test.sh

index ab58b716259df2b99bfd4f391918c364e1067be5..d0ed91589579a5934fdc904cb1f018e2f7381d9c 100755 (executable)
@@ -151,6 +151,10 @@ if [ -n "$DO_DOWNLOAD" ]; then
     fi
 
     BOWER=$(pickcmd node_modules/bower/bin/bower bower)
+    if [ -f "$BOWER" ]; then
+      NODE=$(pickcmd node nodejs)
+      BOWER="$NODE $BOWER"
+    fi
     # Without the force flag bower won't check for new versions or verify that installed software matches version specified in bower.json
     $BOWER install -f
   popd
index 8cf25ba2a29d274a2485ed22b531e5faef5b9224..1a114feaae6df8db7162f5d1e6ba7e990e7062b3 100644 (file)
@@ -1,6 +1,12 @@
 #!/bin/bash
 if which node_modules/karma/bin/karma >> /dev/null; then
-  node node_modules/karma/bin/karma start
+  if which nodejs >> /dev/null; then
+    ## Debian
+    nodejs node_modules/karma/bin/karma start
+  else
+    ## Official
+    node node_modules/karma/bin/karma start
+  fi
 elif which karma >> /dev/null ; then
   karma start
 else