[DRE-commits] [gem2deb] 03/06: dh-make-ruby: when test/ or spec/ exists, create debian/ruby-tests.rake
Antonio Terceiro
terceiro at moszumanska.debian.org
Mon Sep 8 20:33:51 UTC 2014
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to branch master
in repository gem2deb.
commit e01165e70bc4dbb97b4141ef00cf91afde06b7c6
Author: Antonio Terceiro <terceiro at debian.org>
Date: Mon Sep 8 14:54:50 2014 -0300
dh-make-ruby: when test/ or spec/ exists, create debian/ruby-tests.rake
---
debian/changelog | 4 +-
debian/control | 1 +
lib/gem2deb/dh_make_ruby.rb | 48 ++++++++++--------------
lib/gem2deb/dh_make_ruby/template/debian/control | 2 +-
test/unit/setup_rb_installer_test.rb | 1 +
5 files changed, 26 insertions(+), 30 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index ab1587e..c39ea09 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,13 @@
gem2deb (0.9.2) UNRELEASED; urgency=medium
* gem2deb-test-runner: add '.' to $LOAD_PATH with --autopkgtest
- * Gem2Deb::TestRunner: remove innocuous constructor
* dh-make-ruby won't create debian/tests/control anymore since autopkgtest
will now auto-detect Ruby packages and assume an implicit tests
definition. debian/tests/control.ex will be created instead, with comments
explaining to either modify it and rename to control, or delete it.
+ * dh-make-ruby: when test/ or spec/ exists, create debian/ruby-tests.rake
+ with the appropriate rake invocation to run the tests, instead of being
+ insecure and creating files all commented out.
-- Antonio Terceiro <terceiro at debian.org> Tue, 02 Sep 2014 20:10:55 -0300
diff --git a/debian/control b/debian/control
index 272a43d..1fddfb6 100644
--- a/debian/control
+++ b/debian/control
@@ -13,6 +13,7 @@ Build-Depends: debhelper (>= 7.0.50~),
rake,
ruby-all-dev (>= 1:2.1.0.3~),
ruby-mocha (>= 0.14.0),
+ ruby-rspec,
ruby-setup,
ruby-shoulda-context,
ruby-test-unit
diff --git a/lib/gem2deb/dh_make_ruby.rb b/lib/gem2deb/dh_make_ruby.rb
index 3b6749e..108f86a 100644
--- a/lib/gem2deb/dh_make_ruby.rb
+++ b/lib/gem2deb/dh_make_ruby.rb
@@ -58,6 +58,8 @@ module Gem2Deb
attr_accessor :do_wnpp_check
+ attr_accessor :extra_build_dependencies
+
def initialize(input, options = {})
initialize_from_options(options)
if File.directory?(input)
@@ -65,6 +67,7 @@ module Gem2Deb
else
initialize_from_tarball(input)
end
+ @extra_build_dependencies = []
end
def initialize_from_options(options)
@@ -141,9 +144,10 @@ module Gem2Deb
def build_in_directory(directory)
Dir.chdir(directory) do
read_upstream_source_info
- create_debian_boilerplates
+ FileUtils.mkdir_p('debian')
other_files
test_suite
+ create_debian_boilerplates
end
end
@@ -303,21 +307,16 @@ module Gem2Deb
def test_suite_rspec
if File::directory?("spec")
+ extra_build_dependencies << 'ruby-rspec' << 'rake'
write_if_missing("debian/ruby-tests.rake") do |f|
f.puts <<-EOF
-# FIXME
-# there's a spec/ directory in the upstream source.
-# The recommended way to run the RSpec suite is via a rake task.
-# The following commands are enough in many cases and can be adapted to other
-# situations.
-#
-# require 'rspec/core/rake_task'
-#
-# RSpec::Core::RakeTask.new(:spec) do |spec|
-# spec.pattern = './spec/*_spec.rb'
-# end
-#
-# task :default => :spec
+require 'rspec/core/rake_task'
+
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = './spec/*_spec.rb'
+end
+
+task :default => :spec
EOF
end
true
@@ -340,21 +339,14 @@ module Gem2Deb
def test_suite_rb
if File::directory?("test")
- write_if_missing("debian/ruby-tests.rb") do |f|
+ extra_build_dependencies << 'rake'
+ write_if_missing("debian/ruby-tests.rake") do |f|
f.puts <<-EOF
-# FIXME
-# there's a test/ directory in the upstream source, but
-# no test suite was defined in the Gem specification. It would be
-# a good idea to define it here so the package gets tested at build time.
-# Examples:
-# $: << './test/'
-# Dir['./test/**/*.rb'].each { |f| require f }
-#
-# require './test/ts_foo.rb'
-#
-# require 'rbconfig'
-# ruby = ENV['RUBY_TEST_BIN']
-# exec("\#{ruby} -I. test/runtests.rb")
+require 'gem2deb/rake/testtask'
+
+Gem2Deb::Rake::TestTask.new do |t|
+ t.test_files = FileList['test/*_test.rb']
+end
EOF
end
true
diff --git a/lib/gem2deb/dh_make_ruby/template/debian/control b/lib/gem2deb/dh_make_ruby/template/debian/control
index 883305b..c996353 100644
--- a/lib/gem2deb/dh_make_ruby/template/debian/control
+++ b/lib/gem2deb/dh_make_ruby/template/debian/control
@@ -3,7 +3,7 @@ Section: ruby
Priority: optional
Maintainer: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>
Uploaders: <%= maintainer['DEBFULLNAME'] %> <<%= maintainer['DEBEMAIL'] %>>
-Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= <%= Gem2Deb::VERSION %>~)
+Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= <%= Gem2Deb::VERSION %>~)<%= extra_build_dependencies.map { |d| ", #{d}" }.join %>
Standards-Version: 3.9.5
#Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/<%= source_package_name %>.git
#Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-ruby-extras/<%= source_package_name %>.git;a=summary
diff --git a/test/unit/setup_rb_installer_test.rb b/test/unit/setup_rb_installer_test.rb
index 5a423b1..1ad2f0c 100644
--- a/test/unit/setup_rb_installer_test.rb
+++ b/test/unit/setup_rb_installer_test.rb
@@ -54,6 +54,7 @@ class SetupRbInstallerTest < Gem2DebTestCase
dh_ruby.installer_class = Gem2Deb::SetupRbInstaller
dh_ruby.verbose = false
+ ENV['RUBYLIB'] = File.join(File.dirname(__FILE__), '../../lib')
silence_stream(STDOUT) do
silence_stream(STDERR) do
Dir.chdir(package_path) do
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/gem2deb.git
More information about the Pkg-ruby-extras-commits
mailing list