File: rules

package info (click to toggle)
node-tap-mocha-reporter 3.0.7+ds-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 380 kB
  • sloc: makefile: 68; sh: 4
file content (100 lines) | stat: -rwxr-xr-x 2,386 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

include /usr/share/dpkg/pkg-info.mk

# run the test using local copy instead of installed one
RUN_TEST_LOCAL?=1

ifeq ($(RUN_TEST_LOCAL),1)
TAP_MOCHA_JSPATH?=./index.js
TAP_MOCHA_INSTALL_PATH?=./index.js
else
TAP_MOCHA_JSPATH?= tap-mocha-reporter
TAP_MOCHA_INSTALL_PATH?=/usr/bin/tap-mocha-reporter
endif


# newline for make
define newline


endef
space := $(subst ,, )
# remove new line
RAW2LINE:=$(subst $(newline),,$(1))

# find all reporter supported
define FIND_REPORTER_JS_RAW
    'use strict';
    try {
	var F = require('$(TAP_MOCHA_JSPATH)');
	var s = F.types.join(' ')
		.replace(/\s*$$/g,'')
		.replace(/^\s*/g,'')
		.replace(/^\s+/g,' ');
	process.stdout.write(s);
	process.exit(0);
    }
    catch (e) {
	process.stderr.write(e);
	process.exit(1);
    }
endef


FIND_REPORTER_JS:=$(subst $(newline),,$(FIND_REPORTER_JS_RAW))
# shell command to get reporter list
REPORTER_LIST_CMD:=node -pe "$(FIND_REPORTER_JS)"

%:
	dh $@

#override_dh_auto_build:

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
override_dh_auto_test: run_test_suite
else
override_dh_auto_test:
endif

# run a smoke test
run_test_suite:
	set -e; \
	REPORTER_LIST=`set -e;$(REPORTER_LIST_CMD)`; \
	echo "List of reporter: $$REPORTER_LIST"; \
	for r in $$REPORTER_LIST; do  \
		echo "Use reporter $$r";  \
		echo "=========================================================" ; \
		tap test/*.js | $(TAP_MOCHA_INSTALL_PATH) $$r ; \
		echo "=========================================================" ; \
	done

override_dh_fixperms:
	dh_fixperms
	chmod a+x debian/node-tap-mocha-reporter/usr/lib/nodejs/tap-mocha-reporter/index.js

%.1.xml : %.1.xml.in
	REPORTER_LIST_PARA=`set -e;$(REPORTER_LIST_CMD) | sed s', ,</para></listitem><listitem><para>,g'`;\
	sed -e "s/@VERSION@/$(DEB_VERSION_UPSTREAM)/g" -e "s,@LIST_OFENTRY@,$$REPORTER_LIST_PARA,g" $< > $@
%.1: %.1.xml
	cd $(dir $<) &&  docbook2x-man --encoding=utf-8 $(notdir $<)

ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
override_dh_installman: debian/tap-mocha-reporter.1
	dh_installman
else
override_dh_installman:
endif

override_dh_installman_clean:
	rm -rf debian/*.1.xml
	rm -rf debian/*.1

override_dh_clean: override_dh_installman_clean
	dh_clean

.PHONY: run_test_suite override_dh_installman_clean