--- lib/gem2deb/dh_make_ruby.rb | 16 +++++++++++++++- test/unit/dh_make_ruby_test.rb | 12 ++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/lib/gem2deb/dh_make_ruby.rb b/lib/gem2deb/dh_make_ruby.rb index 723c752..f5a1a48 100644 --- a/lib/gem2deb/dh_make_ruby.rb +++ b/lib/gem2deb/dh_make_ruby.rb @@ -187,10 +187,24 @@ module Gem2Deb end end + def wnpp_check + `wnpp-check #{source_package_name}` + end + + def itp_bug + if wnpp_check.length > 0 + wnpp_check.split(" ")[2].chomp(")") + else + "#nnnn" + end + end + def create_debian_boilerplates FileUtils.mkdir_p('debian') unless File.exists?('debian/changelog') - run('dch', '--create', '--empty', '--package', source_package_name, '--newversion', "#{gem_version}-1", 'Initial release (Closes: #nnnn)') + run('dch', '--create', '--empty', '--package', source_package_name, + '--newversion', "#{gem_version}-1", + "Initial release (Closes: #{itp_bug})") end templates.each do |template| FileUtils.mkdir_p(template.directory) diff --git a/test/unit/dh_make_ruby_test.rb b/test/unit/dh_make_ruby_test.rb index 688aeb6..0bdf905 100644 --- a/test/unit/dh_make_ruby_test.rb +++ b/test/unit/dh_make_ruby_test.rb @@ -30,6 +30,18 @@ class DhMakeRubyTest < Gem2DebTestCase assert_equal 'ruby-foo', Gem2Deb::DhMakeRuby.new('foo_ruby-1.2.3.tar.gz').source_package_name end + should 'not use #nnnn if no ITP bug exists' do + @dh_make_ruby = Gem2Deb::DhMakeRuby.new('ruby_foo-1.2.3.tar.gz') + @dh_make_ruby.stubs(:wnpp_check).returns('') + assert_equal @dh_make_ruby.itp_bug, '#nnnn' + end + + should 'use ITP bug if it exists' do + @dh_make_ruby = Gem2Deb::DhMakeRuby.new('ruby_foo-1.2.3.tar.gz') + @dh_make_ruby.stubs(:wnpp_check).returns('(ITP - #42) http://bugs.debian.org/42 ruby-foo') + assert_equal @dh_make_ruby.itp_bug, '#42' + end + context 'simple gem' do %w[ debian/control -- 1.9.2 -- To UNSUBSCRIBE, email to debian-ruby-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/1397861892-17651-1-git-send-email-avtob...@gmail.com