#!/usr/bin/make -f

%:
	dh $@  --buildsystem=golang --with=golang --sourcedirectory=go --builddirectory=_build
	dh $@ --buildsystem=ruby --with ruby

override_dh_clean:
	dh_clean
	## Remove Files-Excluded (when built from checkout or non-DFSG tarball):
	$(RM) -rv `perl -0nE 'say $$1 if m{^Files\-Excluded\:\s*(.*?)(?:\n\n|Files:|Comment:)}sm;' debian/copyright`
	-find go/vendor -mindepth 1 -type d -empty -delete -printf 'removed %p\n'

override_dh_auto_install:
	dh_auto_install
	mkdir -p debian/gitlab-shell/usr/share/gitlab-shell
	mv debian/gitlab-shell/usr/bin debian/gitlab-shell/usr/share/gitlab-shell

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
	-dh_auto_test -O--buildsystem=golang -O--package=gitlab-shell
	dh_auto_test -O--buildsystem=ruby -O--package=gitlab-shell
endif
