BASE_DIR = ENV["SUP_BASE"] || File.join(ENV["HOME"], ".sup")
CONFIG_FN = File.join(BASE_DIR, "config.yaml")
+ COLOR_FN = File.join(BASE_DIR, "colors.yaml")
SOURCE_FN = File.join(BASE_DIR, "sources.yaml")
LABEL_FN = File.join(BASE_DIR, "labels.txt")
- PERSON_FN = File.join(BASE_DIR, "people.txt")
CONTACT_FN = File.join(BASE_DIR, "contacts.txt")
DRAFT_DIR = File.join(BASE_DIR, "drafts")
SENT_FN = File.join(BASE_DIR, "sent.mbox")
YAML_DOMAIN = "masanjin.net"
YAML_DATE = "2006-10-01"
-## record exceptions thrown in threads nicely
+ ## record exceptions thrown in threads nicely
+ @exceptions = []
+ @exception_mutex = Mutex.new
+
+ attr_reader :exceptions
+ def record_exception e, name
+ @exception_mutex.synchronize do
+ @exceptions ||= []
+ @exceptions << [e, name]
+ end
+ end
+
def reporting_thread name
if $opts[:no_threads]
yield
begin
yield
rescue Exception => e
- $exceptions ||= []
- $exceptions << [e, name]
- raise
+ record_exception e, name
end
end
end
end
- module_function :reporting_thread
+
+ module_function :reporting_thread, :record_exception, :exceptions
## one-stop shop for yamliciousness
def save_yaml_obj object, fn, safe=false
end
def start
- Redwood::PersonManager.new Redwood::PERSON_FN
Redwood::SentManager.new Redwood::SENT_FN
Redwood::ContactManager.new Redwood::CONTACT_FN
Redwood::LabelManager.new Redwood::LABEL_FN
def finish
Redwood::LabelManager.save if Redwood::LabelManager.instantiated?
Redwood::ContactManager.save if Redwood::ContactManager.instantiated?
- Redwood::PersonManager.save if Redwood::PersonManager.instantiated?
Redwood::BufferManager.deinstantiate! if Redwood::BufferManager.instantiated?
end
:confirm_no_attachments => true,
:confirm_top_posting => true,
:discard_snippets_from_encrypted_messages => false,
+ :default_attachment_save_dir => "",
}
begin
FileUtils.mkdir_p Redwood::BASE_DIR