#!/usr/bin/make -f
#export DH_VERBOSE=1
#
# Uncomment to ignore all test failures (but the tests will run anyway)
#export DH_RUBY_IGNORE_TESTS=all
#
# Uncomment to ignore some test failures (but the tests will run anyway).
# Valid values:
#export DH_RUBY_IGNORE_TESTS=ruby1.8 ruby1.9.1 require-rubygems
#
# If you need to specify the .gemspec (eg there is more than one)
export DH_RUBY_GEMSPEC=debian/ticgit-ng.gemspec

include /usr/share/dpkg/default.mk

%:
	dh $@ --buildsystem=ruby --with ruby,bash-completion

override_dh_auto_build:
	dh_auto_build
	docbook-to-man debian/ti.sgml >debian/ti.1
	docbook-to-man debian/ticgitweb.sgml >debian/ticgitweb.1

override_dh_auto_install:
	dh_auto_install
	mkdir -p debian/ticgitweb/usr/bin
	mv debian/ticgit/usr/bin/ticgitweb debian/ticgitweb/usr/bin/ticgitweb

override_dh_auto_clean:
	# create a static gemspec
	sed -n -e "/Gem::Spec/,$$ { s/TicGitNG::VERSION/\"$(DEB_VERSION_UPSTREAM)\"/; p }" ticgit-ng.gemspec > debian/ticgit-ng.gemspec
	dh_auto_clean
	rm -rf debian/html build-stamp debian/ti.1 debian/ticgitweb.1
