Mattflaschen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/151975

Change subject: LSG: Allow the style guide to build without npm present at 
runtime
......................................................................

LSG: Allow the style guide to build without npm present at runtime

By only requiring the actual kss-node executable, this allows
running "npm install" at a separate time/machine from the actual
build.

For example, this is useful since the machines used to run Tool Labs
grid jobs do not have npm.

Change-Id: I561b365d4aaf44d921fb54a020e9ff6319318063
---
M docs/kss/Makefile
A docs/kss/scripts/kss-node-check.sh
D docs/kss/scripts/nodecheck.sh
3 files changed, 23 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/75/151975/1

diff --git a/docs/kss/Makefile b/docs/kss/Makefile
index 7d2ee3b..ff735d5 100644
--- a/docs/kss/Makefile
+++ b/docs/kss/Makefile
@@ -1,8 +1,6 @@
 MEDIAWIKI_LOAD_URL ?= http://localhost/w/load.php
 
-kss: nodecheck
-# FIXME: Use more up-to-date Ruby version
-
+kss: kssnodecheck
 # Generates CSS of mediawiki.ui and mediawiki.ui.button using ResourceLoader, 
then applies it to the
 # KSS style guide
        $(eval KSS_RL_TMP := $(shell mktemp /tmp/tmp.XXXXXXXXXX))
@@ -15,5 +13,5 @@
        @command -v xdg-open >/dev/null 2>&1 || { open 
${PWD}/static/index.html; exit 0; }
        @xdg-open ${PWD}/static/index.html
 
-nodecheck:
-       @scripts/nodecheck.sh
+kssnodecheck:
+       @scripts/kss-node-check.sh
diff --git a/docs/kss/scripts/kss-node-check.sh 
b/docs/kss/scripts/kss-node-check.sh
new file mode 100644
index 0000000..84ee1c4
--- /dev/null
+++ b/docs/kss/scripts/kss-node-check.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+if command -v npm > /dev/null ; then
+  npm install
+else
+  # If npm isn't installed, but kss-node is, exit normally.
+  # This allows setting it up on one machine, and running it on
+  # another (e.g. Tools Labs execution nodes) that doesn't have npm
+  # installed.  However, "npm install" still needs to be run
+  # occasionally to keep kss updated.
+
+  KSS_NODE="${BASH_SOURCE%/*}/../node_modules/.bin/kss-node"
+  if ! [ -x "$KSS_NODE" ] ; then
+    echo "Neither kss-node nor npm are installed."
+    echo "To install npm, see http://nodejs.org/";
+    echo "When npm is installed, the Makefile can automatically"
+    echo "install kss-node."
+    exit 1
+  fi
+fi
diff --git a/docs/kss/scripts/nodecheck.sh b/docs/kss/scripts/nodecheck.sh
deleted file mode 100755
index 3ee0f83..0000000
--- a/docs/kss/scripts/nodecheck.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-if command -v npm > /dev/null ; then
-  npm install
-else
-  echo "You need to install Node.JS!"
-  echo "See http://nodejs.org/";
-  exit 1
-fi

-- 
To view, visit https://gerrit.wikimedia.org/r/151975
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I561b365d4aaf44d921fb54a020e9ff6319318063
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to