From aaad04cc0f593724ac02c2c6f16d07e4fcb9878e Mon Sep 17 00:00:00 2001 From: wmorgan Date: Sun, 1 Apr 2007 22:45:03 +0000 Subject: [PATCH] final logging output fixed git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@360 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- bin/sup | 11 +++++------ bin/sup-add | 1 - bin/sup-sync | 1 - doc/TODO | 6 +++--- lib/sup.rb | 1 + lib/sup/index.rb | 1 + lib/sup/logger.rb | 2 +- lib/sup/util.rb | 3 ++- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/sup b/bin/sup index dc1f2f9..2572fc2 100644 --- a/bin/sup +++ b/bin/sup @@ -207,12 +207,11 @@ rescue Exception => e ensure Redwood::finish stop_cursing - - # don't ask me why, but sometimes it's necessary to print something - # to stderr at this point or the exception doesn't get printed. - # doesn't get printed. WHY? - - $stderr.puts " " + if $exception + Redwood::log "oh crap, an exception" + else + Redwood::log "good night, sweet prince!" + end end Index.save unless $exception # TODO: think about this diff --git a/bin/sup-add b/bin/sup-add index b0d8457..caff68d 100644 --- a/bin/sup-add +++ b/bin/sup-add @@ -110,6 +110,5 @@ ARGV.each do |uri| index.add_source source end -say "Saving source list..." index.save Redwood::finish diff --git a/bin/sup-sync b/bin/sup-sync index bf7538d..f71f6b0 100644 --- a/bin/sup-sync +++ b/bin/sup-sync @@ -200,7 +200,6 @@ begin $stderr.puts "Restored state on #{num_restored} (#{100.0 * num_restored / num_scanned}%) messages." if num_restored > 0 end ensure - $stderr.puts "Saving index and sources..." index.save Redwood::finish end diff --git a/doc/TODO b/doc/TODO index 42c97e0..7888df7 100644 --- a/doc/TODO +++ b/doc/TODO @@ -5,12 +5,12 @@ _ bugfix: when one new message comes into an imap folder, we don't catch it until a reload _ bugfix: triggering a pageup when cursor scrolling up jumps to the bottom of the page rather than the next line - blank compose-mode rather than do nothing _ bugfix: add new message counts until keypress _ bugfix: attachment filenames sometimes not detected (filename=) -_ bugfix: final logging messages to stdout? +x bugfix: final logging messages to stdout? x bugfix: mbox directory shouldn't generate an exception, just an error x bugfix: m in thread-view-mode when a person is not selected should open up a + blank compose-mode rather than do nothing x bugfix: stars on messages with blue backgrounds still have green bgs x ferret upgrade script (dump & restore) x bugfix: mark messages as read immediately when t-v-m is opened @@ -33,7 +33,7 @@ _ select all, starred, to me, etc _ undo _ gmail _ warnings: top-posting, missing attachment, ruby-talk:XXXX detection -_ mboxz (compressed mbox) +_ mboxz, mboxbz future ------ diff --git a/lib/sup.rb b/lib/sup.rb index a4fd388..f672d9e 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -93,6 +93,7 @@ module Redwood Redwood::LabelManager.save Redwood::ContactManager.save Redwood::PersonManager.save + Redwood::BufferManager.deinstantiate! end ## not really a good place for this, so I'll just dump it here. diff --git a/lib/sup/index.rb b/lib/sup/index.rb index 18efe86..2fa70cd 100644 --- a/lib/sup/index.rb +++ b/lib/sup/index.rb @@ -30,6 +30,7 @@ class Index end def save + Redwood::log "saving index and sources..." FileUtils.mkdir_p @dir unless File.exists? @dir save_sources save_index diff --git a/lib/sup/logger.rb b/lib/sup/logger.rb index b587e6b..95cff62 100644 --- a/lib/sup/logger.rb +++ b/lib/sup/logger.rb @@ -26,7 +26,7 @@ class Logger # $stderr.puts s make_buf @mode << "#{Time.now}: #{s.chomp}\n" - $stderr.puts "[#{Time.now}] #{s.chomp}" unless @mode.buffer + $stderr.puts "[#{Time.now}] #{s.chomp}" unless BufferManager.instantiated? && @mode.buffer end def self.method_missing m, *a diff --git a/lib/sup/util.rb b/lib/sup/util.rb index 9863282..e13aac4 100644 --- a/lib/sup/util.rb +++ b/lib/sup/util.rb @@ -263,11 +263,12 @@ end ## allows for constructors that take arguments. ## ## You must have #initialize call "self.class.i_am_the_instance self" -## at some point or everything will fail horribly +## at some point or everything will fail horribly. module Singleton module ClassMethods def instance; @instance; end def instantiated?; defined?(@instance) && !@instance.nil?; end + def deinstantiate!; @instance = nil; end def method_missing meth, *a, &b raise "no instance defined!" unless defined? @instance @instance.send meth, *a, &b -- 2.45.2