[DRE-commits] [rerun] 01/02: Add support for restarting with SIGHUP

Antonio Terceiro terceiro at moszumanska.debian.org
Mon Aug 10 13:25:04 UTC 2015


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

terceiro pushed a commit to branch master
in repository rerun.

commit 965e708797768fa4b83c6f9d5793ab0dd58b924a
Author: Antonio Terceiro <terceiro at softwarelivre.org>
Date:   Mon Aug 10 09:58:25 2015 -0300

    Add support for restarting with SIGHUP
---
 debian/changelog                                   |  3 +-
 ...03-Add-support-for-restarting-with-SIGHUP.patch | 64 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 4444167..2bcbdee 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,7 +3,8 @@ rerun (0.10.0-1) UNRELEASED; urgency=medium
   * Initial release (Closes: #794952)
   * Patches:
     - 0001-Read-version-number-from-installed-gemspec.patch
-    - debian/patches/0002-Port-to-listen-3.patch
+    - 0002-Port-to-listen-3.patch
+    - 0003-Add-support-for-restarting-with-SIGHUP.patch
   * Update packaging with a new dh-make-ruby run
 
  -- Antonio Terceiro <terceiro at debian.org>  Sat, 08 Aug 2015 10:19:47 -0300
diff --git a/debian/patches/0003-Add-support-for-restarting-with-SIGHUP.patch b/debian/patches/0003-Add-support-for-restarting-with-SIGHUP.patch
new file mode 100644
index 0000000..dd0f84c
--- /dev/null
+++ b/debian/patches/0003-Add-support-for-restarting-with-SIGHUP.patch
@@ -0,0 +1,64 @@
+From: Antonio Terceiro <terceiro at softwarelivre.org>
+Date: Mon, 10 Aug 2015 09:54:27 -0300
+Subject: Add support for restarting with SIGHUP
+
+Useful with unicorn and other processes that can do the right thing when
+sent a SIGHUP.
+---
+ lib/rerun/options.rb |  5 +++++
+ lib/rerun/runner.rb  | 12 ++++++++++--
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/lib/rerun/options.rb b/lib/rerun/options.rb
+index a5b1aaf..0005a3f 100644
+--- a/lib/rerun/options.rb
++++ b/lib/rerun/options.rb
+@@ -14,6 +14,7 @@ module Rerun
+     DEFAULTS = {
+         :pattern => DEFAULT_PATTERN,
+         :signal => "TERM",
++        :hup => false,
+         :growl => true,
+         :name => Pathname.getwd.basename.to_s.capitalize,
+         :ignore => []
+@@ -49,6 +50,10 @@ module Rerun
+           options[:signal] = signal
+         end
+ 
++        opts.on('-h', '--hup', "sends SIGHUP and lets process restart by itself (implies --signal HUP)") do
++          options[:hup] = true
++        end
++
+         opts.on("-c", "--clear", "clear screen before each run") do
+           options[:clear] = true
+         end
+diff --git a/lib/rerun/runner.rb b/lib/rerun/runner.rb
+index dcb041f..f369035 100644
+--- a/lib/rerun/runner.rb
++++ b/lib/rerun/runner.rb
+@@ -60,8 +60,12 @@ module Rerun
+ 
+     def restart
+       @restarting = true
+-      stop
+-      start
++      if hup?
++        signal('HUP')
++      else
++        stop
++        start
++      end
+       @restarting = false
+     end
+ 
+@@ -113,6 +117,10 @@ module Rerun
+       @options[:name]
+     end
+ 
++    def hup?
++      @options[:hup]
++    end
++
+     def start
+       if windows?
+         raise "Sorry, Rerun does not work on Windows."
diff --git a/debian/patches/series b/debian/patches/series
index fad3e0a..7a6e0f8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 0001-Read-version-number-from-installed-gemspec.patch
 0002-Port-to-listen-3.patch
+0003-Add-support-for-restarting-with-SIGHUP.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/rerun.git



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