[DRE-commits] [SCM] gem2deb.git branch, master, updated. debian/0.2.3-52-g3092732

Antonio Terceiro terceiro at softwarelivre.org
Tue Jul 19 01:35:02 UTC 2011


The following commit has been merged in the master branch:
commit 94ab8f2d317efe3a44de63ce2094ab620c8ab2f3
Author: Antonio Terceiro <terceiro at softwarelivre.org>
Date:   Sat Jul 16 12:52:59 2011 -0700

    Remove Build-Depends: on rake
    
    Rakefile still contains some utilities for gem2deb developers, but is
    not required to build the package anymore.

diff --git a/Rakefile b/Rakefile
index 739b49e..bf5d5e7 100644
--- a/Rakefile
+++ b/Rakefile
@@ -2,23 +2,16 @@ require 'rake/testtask'
 
 task :default => :test
 
-task :test => :version_check do
-  puts '=> Unit tests'
-  Rake::Task['test:unit'].invoke
-  puts '=> Integration tests'
-  Rake::Task['test:integration'].invoke
+task :test do
+  sh './test/run'
 end
 
-Rake::TestTask.new('test:unit') do |t|
-  t.libs << "test"
-  t.test_files = FileList['test/unit/*_test.rb']
-  t.verbose = true
+task 'test:unit' do
+  sh './test/run unit'
 end
 
-Rake::TestTask.new('test:integration') do |t|
-  t.libs << 'test'
-  t.test_files = FileList['test/integration/*_test.rb']
-  t.verbose = true
+task 'test:integration' do
+  sh './test/run integration'
 end
 
 desc "Run tests in debug mode (e.g. don't delete temporary files)"
@@ -43,18 +36,3 @@ task :snapshot do
   sh 'ls debian/changelog.git'
   sh 'mv debian/changelog.git debian/changelog'
 end
-
-desc "Checks for inconsistencies between version numbers in the code and in debian/changelog"
-task :version_check do
-  code_version = `ruby -Ilib -rgem2deb -e 'puts Gem2Deb::VERSION'`.strip
-  debian_version = `dpkg-parsechangelog | grep '^Version: ' | cut -d ' ' -f 2`.strip
-  if code_version != debian_version
-    msg ="W: Inconsistent version numbers: lib/gem2deb.rb says #{code_version}, debian/changelog says #{debian_version}"
-    if STDIN.isatty && STDOUT.isatty && STDERR.isatty
-      # highlight the message in red
-      puts("\033[31;40m%s\033[m" % msg)
-    else
-      puts msg
-    end
-  end
-end
diff --git a/debian/control b/debian/control
index f5e8340..709ba66 100644
--- a/debian/control
+++ b/debian/control
@@ -3,10 +3,10 @@ Section: ruby
 Priority: optional
 Maintainer: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>
 Uploaders: Lucas Nussbaum <lucas at debian.org>, 
-           Antonio Terceiro <terceiro at softwarelivre.org>,
+           Antonio Terceiro <terceiro at debian.org>,
            Vincent Fourmond <fourmond at debian.org>
 DM-Upload-Allowed: yes
-Build-Depends: debhelper (>= 7.0.50~), rake, ruby-shoulda-context, ruby-mocha, rubygems1.8, ruby1.8, ruby1.8-dev, ruby1.9.1, ruby1.9.1-dev, devscripts, ruby-setup
+Build-Depends: debhelper (>= 7.0.50~), ruby-shoulda-context, ruby-mocha, rubygems1.8, ruby1.8, ruby1.8-dev, ruby1.9.1, ruby1.9.1-dev, devscripts, ruby-setup
 Standards-Version: 3.9.2
 Vcs-Git: git://git.debian.org/pkg-ruby-extras/gem2deb.git
 Vcs-Browser: http://git.debian.org/?p=pkg-ruby-extras/gem2deb.git;a=summary
diff --git a/debian/rules b/debian/rules
index 5f6c5eb..7f610c9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,7 +6,7 @@
 override_dh_auto_build:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
 	# NO_PKG_MANGLE=1 is only useful on Ubuntu buildds, to disable pkgbinarymangler
-	NO_PKG_MANGLE=1 rake test
+	NO_PKG_MANGLE=1 ./test/run
 endif
 	mkdir -p man
 	for i in bin/*; do pod2man -c "" -r "" $$i > man/$$(basename $$i).1; done
diff --git a/test/loader.rb b/test/loader.rb
new file mode 100644
index 0000000..6317837
--- /dev/null
+++ b/test/loader.rb
@@ -0,0 +1 @@
+ARGV.each { |f| require f }
diff --git a/test/run b/test/run
new file mode 100755
index 0000000..9750a8a
--- /dev/null
+++ b/test/run
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+set -e
+
+RUBY='ruby1.8'
+
+run_unit_tests=false
+run_integration_tests=false
+run_version_check_tests=false
+which_tests="$1"
+case "$which_tests" in
+  unit|integration|version_check)
+    eval "run_${which_tests}_tests=true"
+    ;;
+  '')
+    run_unit_tests=true
+    run_integration_tests=true
+    run_version_check_tests=true
+    ;;
+  *)
+    echo "usage: $0 [unit|integration|version_check]"
+    exit 1
+    ;;
+esac
+
+run_tests() {
+  echo $RUBY -Ilib:test test/loader.rb $@
+  $RUBY -Ilib:test test/loader.rb $@
+}
+
+maybe_check_version_number() {
+  if test $run_version_check_tests != true; then
+    return
+  fi
+  code_version=$(ruby -Ilib -rgem2deb -e 'puts Gem2Deb::VERSION')
+  debian_version=$(dpkg-parsechangelog | grep '^Version: ' | cut -d ' ' -f 2)
+  if test "$code_version" != "debian_version"; then
+    msg="W: Inconsistent version numbers: lib/gem2deb.rb says ${code_version}, debian/changelog says ${debian_version}"
+    if test -t 0 && test -t 1 && test -t 2; then
+      printf "\033[31;40m${msg}\033[m\n"
+    else
+      printf "$msg\n"
+    fi
+  fi
+}
+
+maybe_run_unit_tests() {
+  if test $run_unit_tests = true; then
+    echo "Running unit tests"
+    run_tests test/unit/*_test.rb
+  fi
+}
+maybe_run_integration_tests() {
+  if test $run_integration_tests = true; then
+    echo "Running integration tests"
+    run_tests test/integration/*_test.rb
+  fi
+}
+
+maybe_check_version_number
+maybe_run_unit_tests
+maybe_run_integration_tests

-- 
gem2deb.git



More information about the Pkg-ruby-extras-commits mailing list