[DRE-commits] [gem2deb] 03/05: dh_ruby: allow options to be passed in any order

Antonio Terceiro terceiro at moszumanska.debian.org
Fri Nov 13 16:37:58 UTC 2015


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch master
in repository gem2deb.

commit e8354f81e1eea98d355f5bb7ef4bd28c75b43b3b
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Wed Nov 11 15:15:39 2015 -0200

    dh_ruby: allow options to be passed in any order
---
 bin/dh_ruby      | 32 +++++++++++++++++++-------------
 debian/changelog |  1 +
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/bin/dh_ruby b/bin/dh_ruby
index 527555f..5f2997a 100755
--- a/bin/dh_ruby
+++ b/bin/dh_ruby
@@ -28,8 +28,8 @@ if ENV['DH_RUBY']
   ARGV.unshift(*opts)
 end
 
-
 engine = Gem2Deb::DhRuby.new
+action = nil
 
 optparse = OptionParser.new do |opts|
   opts.banner = "Usage: dh_ruby [OPTIONS]"
@@ -61,34 +61,39 @@ optparse = OptionParser.new do |opts|
   end
 
   opts.on('--clean', 'debhelper clean helper') do
-    engine.clean
-    exit(0)
+    action = :clean
   end
 
   opts.on('--configure', 'debhelper configure helper') do
-    engine.configure
-    exit(0)
+    action = :configure
   end
 
   opts.on('--build', 'debhelper build helper') do
-    engine.build
-    exit(0)
+    action = :build
   end
 
   opts.on('--test', 'debhelper test helper') do
-    engine.test
-    exit(0)
+    action = :test
   end
 
   opts.on('--install', 'debhelper install helper') do
-    engine.install(ARGV)
-    exit(0)
+    action = :install
   end
 end
 optparse.parse!
 
-puts optparse
-exit(1)
+if action.nil?
+  puts "E: no action selected. You must pass one (and only one) of:"
+  puts "   --install, --clean, --configure, --build, --test"
+  puts optparse
+  exit(1)
+end
+
+if action == :install
+  engine.install(ARGV)
+else
+  engine.send(action)
+end
 
 __END__
 =head1 NAME
@@ -97,6 +102,7 @@ dh_ruby - debhelper7 build system for Ruby software
 
 =head1 SYNOPSIS
 
+
 B<dh_ruby> [I<OPTIONS>]
 
 =head1 DESCRIPTION
diff --git a/debian/changelog b/debian/changelog
index 9e52022..4022c52 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ gem2deb (0.23) UNRELEASED; urgency=medium
   * dh_ruby:
     - take parameters from the $DH_RUBY environment variable
     - add experimental support for installing packages as gems.
+    - allow options to be passed in any order
 
  -- Antonio Terceiro <terceiro at debian.org>  Wed, 11 Nov 2015 14:50:13 -0200
 

-- 
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