lib/sup.rb in sup-0.9.1 vs lib/sup.rb in sup-0.10

- old
+ new

@@ -35,11 +35,11 @@ end end end module Redwood - VERSION = "0.9.1" + VERSION = "0.10" 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") @@ -52,11 +52,11 @@ HOOK_DIR = File.join(BASE_DIR, "hooks") YAML_DOMAIN = "masanjin.net" YAML_DATE = "2006-10-01" - DEFAULT_INDEX = 'ferret' + DEFAULT_NEW_INDEX_TYPE = 'xapian' ## record exceptions thrown in threads nicely @exceptions = [] @exception_mutex = Mutex.new @@ -186,12 +186,42 @@ #' stupid ruby-mode end end end + ## to be called by entry points in bin/, to ensure that + ## their versions match up against the library versions. + ## + ## this is a perennial source of bug reports from people + ## who both use git and have a gem version installed. + def check_library_version_against v + unless Redwood::VERSION == v + $stderr.puts <<EOS +Error: version mismatch! +The sup executable is at version #{v.inspect}. +The sup libraries are at version #{Redwood::VERSION.inspect}. + +Your development environment may be picking up code from a +rubygems installation of sup. + +If you're running from git with a commandline like + + ruby -Ilib #{$0} + +try this instead: + + RUBY_INVOCATION="ruby -Ilib" ruby -Ilib #{$0} + +You can also try `gem uninstall sup` and removing all Sup rubygems. + +EOS + abort + end + end + module_function :save_yaml_obj, :load_yaml_obj, :start, :finish, - :report_broken_sources + :report_broken_sources, :check_library_version_against end ## set up default configuration file if File.exists? Redwood::CONFIG_FN $config = Redwood::load_yaml_obj Redwood::CONFIG_FN @@ -227,10 +257,11 @@ :ask_for_subject => true, :confirm_no_attachments => true, :confirm_top_posting => true, :discard_snippets_from_encrypted_messages => false, :default_attachment_save_dir => "", - :sent_source => "sup://sent" + :sent_source => "sup://sent", + :poll_interval => 300 } begin FileUtils.mkdir_p Redwood::BASE_DIR Redwood::save_yaml_obj $config, Redwood::CONFIG_FN rescue StandardError => e