#!/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=gem.gemspec

%:
	dh $@ --buildsystem=rubysetuprb --with ruby

override_dh_auto_build:
	dh_auto_build

# And then, we build the documentation
	(cd lib; ln -s webgen webgen0.4)
	(cd doc ; ruby1.8 -I ../lib ../bin/webgen)
	(cd lib; rm -f webgen0.4)

inst_dir = debian/webgen0.4

override_dh_auto_install:
	dh_auto_install

# Removing the gui, not mature enough and too painful to support for now
	rm -rf $(inst_dir)/usr/lib/ruby/1.8/webgen/gui

# Move to webgen0.4
	mv $(inst_dir)/usr/bin/webgen $(inst_dir)/usr/bin/webgen0.4
	mv $(inst_dir)/usr/share/man/man1/webgen.1 $(inst_dir)/usr/share/man/man1/webgen0.4.1

	mv $(inst_dir)/usr/lib/ruby/vendor_ruby/webgen $(inst_dir)/usr/lib/ruby/vendor_ruby/webgen0.4
	mv $(inst_dir)/usr/share/webgen $(inst_dir)/usr/share/webgen0.4


	mkdir -p debian/webgen0.4-doc/usr/share/doc/webgen0.4-doc
	mv doc/output debian/webgen0.4-doc/usr/share/doc/webgen0.4-doc/website

