bin/sup-sync-back in sup-0.11 vs bin/sup-sync-back in sup-0.12
- old
+ new
@@ -2,24 +2,25 @@
require 'rubygems'
require 'uri'
require 'tempfile'
require 'trollop'
-require 'enumerator'
-require "sup"; Redwood::check_library_version_against "0.11"
+require "sup"; Redwood::check_library_version_against "0.12"
+fail "not working yet"
+
## save a message 'm' to an open file pointer 'fp'
def save m, fp
m.source.each_raw_message_line(m.source_info) { |l| fp.print l }
end
def die msg
$stderr.puts "Error: #{msg}"
exit(-1)
end
def has_any_from_source_with_label? index, source, label
query = { :source_id => source.id, :label => label, :limit => 1, :load_spam => true, :load_deleted => true, :load_killed => true }
- not Enumerable::Enumerator.new(index, :each_id, query).map.empty?
+ index.num_results_for(query) != 0
end
opts = Trollop::options do
version "sup-sync-back (sup #{Redwood::VERSION})"
banner <<EOS
@@ -79,15 +80,15 @@
begin
index.load
sources = ARGV.map do |uri|
s = Redwood::SourceManager.source_for(uri) or die "unknown source: #{uri}. Did you add it with sup-add first?"
- s.is_a?(Redwood::MBox::Loader) or die "#{uri} is not an mbox source."
+ s.is_a?(Redwood::MBox) or die "#{uri} is not an mbox source."
s
end
if sources.empty?
- sources = Redwood::SourceManager.usual_sources.select { |s| s.is_a? Redwood::MBox::Loader }
+ sources = Redwood::SourceManager.usual_sources.select { |s| s.is_a? Redwood::MBox }
end
unless sources.all? { |s| s.file_path.nil? } || File.executable?(dotlockfile) || opts[:dont_use_dotlockfile]
die <<EOS
can't execute dotlockfile binary: #{dotlockfile}. Specify --with-dotlockfile