commit 3ec9cd98035e73e7ea28b607c4150b186ea7c2c5
parent 1d10748b5a58c3e7cf125fe45ba44f82e47c1970
Author: William Morgan <wmorgan-sup@masanjin.net>
Date: Sun, 2 Nov 2008 10:54:33 -0800
Merge branch 'master' into next
Diffstat:
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
@@ -11,3 +11,4 @@ Christopher Warrington <chrisw at the rice dot edus>
Giorgio Lando <patroclo7 at the gmail dot coms>
Decklin Foster <decklin at the red-bean dot coms>
Ian Taylor <ian at the lorf dot orgs>
+Sam Roberts <sroberts at the uniserve dot coms>
diff --git a/bin/sup b/bin/sup
@@ -102,7 +102,7 @@ rescue Index::LockError => e
h.say Index.fancy_lock_error_message_for(e)
case h.ask("Should I ask that process to kill itself? ")
- when /^\s*y\s*$/i
+ when /^\s*y(es)?\s*$/i
h.say "Ok, suggesting seppuku..."
FileUtils.touch Redwood::SUICIDE_FN
sleep SuicideManager::DELAY * 2
diff --git a/lib/sup/index.rb b/lib/sup/index.rb
@@ -66,14 +66,19 @@ class Index
@lock_update_thread = nil
end
+ def possibly_pluralize number_of, kind
+ "#{number_of} #{kind}" +
+ if number_of == 1 then "" else "s" end
+ end
+
def fancy_lock_error_message_for e
- secs = Time.now - e.mtime
- mins = secs.to_i / 60
+ secs = (Time.now - e.mtime).to_i
+ mins = secs / 60
time =
if mins == 0
- "#{secs.to_i} seconds"
+ possibly_pluralize secs , "second"
else
- "#{mins} minutes"
+ possibly_pluralize mins, "minute"
end
<<EOS