[DRE-commits] [SCM] gem2deb.git branch, master, updated. 460e84be1f7bd8d430c5ddae46d62fd657ac5fa3

Antonio Terceiro terceiro at softwarelivre.org
Fri Mar 18 14:53:30 UTC 2011


The following commit has been merged in the master branch:
commit 0c03d5aa27e2a48f1409d3dda993cc790e3761dc
Author: Antonio Terceiro <terceiro at softwarelivre.org>
Date:   Tue Mar 8 16:34:42 2011 -0300

    Check consistency of version numbers

diff --git a/Rakefile b/Rakefile
index e215974..56fa03f 100644
--- a/Rakefile
+++ b/Rakefile
@@ -2,7 +2,7 @@ require 'rake/testtask'
 
 task :default => :test
 
-task :test do
+task :test => :version_check do
   puts '=> Unit tests'
   Rake::Task['test:unit'].invoke
   puts '=> Integration tests'
@@ -44,3 +44,18 @@ 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

-- 
gem2deb.git



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