]> git.cworth.org Git - sup/commitdiff
better source error reporting, and better message loading
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sat, 24 Nov 2007 18:39:27 +0000 (18:39 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sat, 24 Nov 2007 18:39:27 +0000 (18:39 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@715 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup.rb
lib/sup/modes/thread-index-mode.rb
lib/sup/poll.rb
lib/sup/util.rb

index 83ed1016e5df6db78645cfb831b7d9b9f80c310c..ac242ecaf905400e8fdfdb0390768f9c29cb8398 100644 (file)
@@ -124,8 +124,10 @@ module Redwood
     return unless BufferManager.instantiated?
 
     broken_sources = Index.usual_sources.select { |s| s.error.is_a? FatalSourceError }
+    File.open("goat", "w") { |f| f.puts Kernel.caller }
     unless broken_sources.empty?
-      BufferManager.spawn "Broken source notification", TextMode.new(<<EOM), opts
+      BufferManager.spawn_unless_exists("Broken source notification for #{broken_sources.join(',')}", opts) do
+        TextMode.new(<<EOM)
 Source error notification
 -------------------------
 
@@ -136,11 +138,13 @@ be viewed, and new messages will not be detected.
 #{broken_sources.map { |s| "Source: " + s.to_s + "\n Error: " + s.error.message.wrap(70).join("\n        ")}.join("\n\n")}
 EOM
 #' stupid ruby-mode
+      end
     end
 
     desynced_sources = Index.usual_sources.select { |s| s.error.is_a? OutOfSyncSourceError }
     unless desynced_sources.empty?
-      BufferManager.spawn "Out-of-sync source notification", TextMode.new(<<EOM), opts
+      BufferManager.spawn_unless_exists("Out-of-sync source notification for #{broken_sources.join(',')}", opts) do
+        TextMode.new(<<EOM)
 Out-of-sync source notification
 -------------------------------
 
@@ -158,6 +162,7 @@ and new messages will not be detected. Luckily, this is easy to correct!
   end}
 EOM
 #' stupid ruby-mode
+      end
     end
   end
 
index aec4ba4c9095c4114d412fb4a800c8c76e285418..533ad8896e61f80eef33ec4e8856ca7a61d2eb62 100644 (file)
@@ -83,10 +83,11 @@ EOS
     ## TODO: don't regen text completely
     Redwood::reporting_thread do
       num = t.size
-      BufferManager.say("Loading message bodies...") do |sid|
+      message = "Loading #{num.pluralize 'message body'}..."
+      BufferManager.say(message) do |sid|
         t.each_with_index do |(m, *o), i|
           next unless m
-          BufferManager.say "Loading message bodies... (#{i + 1}/#{num})", sid if t.size > 1
+          BufferManager.say "#{message} (#{i}/#{num})", sid if t.size > 1
           m.load_from_source! 
         end
       end
index 5aed29b474d6970849c2b74c17effdeec5dcfb33..21464b411573808d0ba47528e552360f865ea3af 100644 (file)
@@ -87,7 +87,7 @@ EOS
           yield "Loading from #{source}... " unless source.done? || source.has_errors?
         rescue SourceError => e
           Redwood::log "problem getting messages from #{source}: #{e.message}"
-          Redwood::report_broken_sources
+          Redwood::report_broken_sources :force_to_top => true
           next
         end
 
@@ -163,7 +163,7 @@ EOS
       end
     rescue SourceError => e
       Redwood::log "problem getting messages from #{source}: #{e.message}"
-      Redwood::report_broken_sources
+      Redwood::report_broken_sources :force_to_top => true
     end
   end
 end
index baf4c50afeb9e943cd6d818c15024caadeb3108a..b2a0a4d0552bcc7584ce28faa8858bf55f96d6c3 100644 (file)
@@ -310,8 +310,18 @@ class Fixnum
     end
   end
 
+  ## hacking the english language
   def pluralize s
-    to_s + " " + (self == 1 ? s : s + "s")
+    to_s + " " +
+      if self == 1
+        s
+      else
+        if s =~ /(.*)y$/
+          $1 + "ies"
+        else
+          s + "s"
+        end
+      end
   end
 end