summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2018-11-21 13:36:55 +0100
committerGitHub <noreply@github.com>2018-11-21 13:36:55 +0100
commit1d7639bae13d158f39251e22a6b933f7e6772441 (patch)
tree366a6f513a1ef0314b75ef9df916b07fe0879d2e
parent902ec4a68f0cd3110e5849c3d429ed34ab3e6091 (diff)
parente629363dea265e52aee4011d66dc4c3380c9ab62 (diff)
Merge pull request #1306 from nextcloud/add-drone-step-to-check-handlebars-templates
Add Drone step to check Handlebars templates
-rw-r--r--.drone.yml9
-rw-r--r--Makefile4
-rwxr-xr-xcheck-handlebars-templates.sh17
-rwxr-xr-xcompile-handlebars-templates.sh6
-rw-r--r--package.json1
5 files changed, 35 insertions, 2 deletions
diff --git a/.drone.yml b/.drone.yml
index f82de7b6b..296577a6f 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -31,6 +31,14 @@ pipeline:
when:
matrix:
TESTS: check-app-compatbility
+ handlebars:
+ image: node
+ commands:
+ - npm install -g handlebars
+ - ./check-handlebars-templates.sh
+ when:
+ matrix:
+ TESTS: handlebars
syntax-php7.0:
image: nextcloudci/php7.0:php7.0-19
environment:
@@ -193,6 +201,7 @@ matrix:
- TESTS: eslint
- TESTS: stylelint
- TESTS: check-app-compatbility
+ - TESTS: handlebars
- TESTS: syntax-php7.0
- TESTS: signed-off-check
- TESTS: php7.0
diff --git a/Makefile b/Makefile
index 74cb75876..da5e92638 100644
--- a/Makefile
+++ b/Makefile
@@ -31,8 +31,8 @@ install-npm-deps:
install-npm-deps-dev:
npm install --deps
-build-js-templates:
- handlebars -n OCA.VideoCalls.Admin.Templates js/admin/templates/ -f js/admin/templates.js
+compile-handlebars-templates: dev-setup
+ bash compile-handlebars-templates.sh
dev-setup: install-npm-deps-dev
diff --git a/check-handlebars-templates.sh b/check-handlebars-templates.sh
new file mode 100755
index 000000000..ae1e63946
--- /dev/null
+++ b/check-handlebars-templates.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+REPODIR=`git rev-parse --show-toplevel`
+
+cd $REPODIR
+
+bash compile-handlebars-templates.sh || exit 1
+
+if [[ $(git diff --name-only) ]]; then
+ echo "Please submit your compiled handlebars templates"
+ echo
+ git diff
+ exit 1
+fi
+
+echo "All up to date! Carry on :D"
+exit 0
diff --git a/compile-handlebars-templates.sh b/compile-handlebars-templates.sh
new file mode 100755
index 000000000..663a5bd83
--- /dev/null
+++ b/compile-handlebars-templates.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+# Prefer the local handlebars script, and fall back to the global one.
+export PATH=./node_modules/.bin/:$PATH
+
+handlebars -n OCA.VideoCalls.Admin.Templates js/admin/templates/ -f js/admin/templates.js
diff --git a/package.json b/package.json
index e79680966..35e629af0 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,7 @@
"author": "",
"license": "AGPL-3.0",
"devDependencies": {
+ "handlebars": "^4.0.12",
"jasmine": "^2.5.2",
"jasmine-ajax": "^3.2.0",
"jasmine-core": "^2.5.2",