#!/usr/bin/make -f

major-rubyversion=$(shell ruby -v | cut -d ' ' -f 2 | cut -d '.' -f 1)
minor-rubyversion=$(shell ruby -v | cut -d ' ' -f 2 | cut -d '.' -f 2)
minormax-rubyversion=$(shell echo $$(( $(minor-rubyversion) + 1 )) )

%:
	dh $@

override_dh_auto_build:
	bundle config set --local path vendor/bundle
	bundle config set --local without 'development test coverage'
	bundle install
	bundle config --local frozen true

override_dh_gencontrol:
	dh_gencontrol -- -Vruby:Depends="ruby (>= 1:$(major-rubyversion).$(minor-rubyversion)), ruby (<< 1:$(major-rubyversion).$(minormax-rubyversion))"

execute_after_dh_install:
	dh_installsystemd --no-enable --no-start blue-hydra.service
