$terminal.wrap_at = :auto
Redwood::start
-index = Redwood::Index.new
-index.load_sources
+index = Redwood::Index.init
+Redwood::SourceManager.load_sources
say <<EOS
Howdy neighbor! This here's sup-config, ready to help you jack in to
$config[:accounts][:default][:signature] = sigfn
$config[:editor] = editor
-Redwood::save_yaml_obj $config, Redwood::CONFIG_FN
-
-say "Ok, I've saved you up a nice lil' #{Redwood::CONFIG_FN}."
done = false
until done
say "\nNow, we'll tell Sup where to find all your email."
- index.load_sources
+ Redwood::SourceManager.load_sources
say "Current sources:"
- if index.sources.empty?
+ if Redwood::SourceManager.sources.empty?
say " No sources!"
else
- index.sources.each { |s| puts "* #{s}" }
+ Redwood::SourceManager.sources.each { |s| puts "* #{s}" }
end
say "\n"
end
end
+say "\nSup needs to know where to store your sent messages."
+say "Only sources capable of storing mail will be listed.\n\n"
+
+Redwood::SourceManager.load_sources
+if Redwood::SourceManager.sources.empty?
+ say "\nUsing the default sup://sent, since you haven't configured other sources yet."
+ $config[:sent_source] = 'sup://sent'
+else
+ # this handles the event that source.yaml already contains the SentLoader
+ # source.
+ have_sup_sent = false
+
+ choose do |menu|
+ menu.prompt = "Store my sent mail in? "
+
+ valid_sents = Redwood::SourceManager.sources.each do |s|
+ have_sup_sent = true if s.to_s.eql?('sup://sent')
+
+ menu.choice(s.to_s) { $config[:sent_source] = s.to_s } if s.respond_to? :store_message
+ end
+
+ menu.choice('Default (sup://sent)') { $config[:sent_source] = 'sup://sent'} unless have_sup_sent
+
+ end
+end
+
+Redwood::save_yaml_obj $config, Redwood::CONFIG_FN
+
+say "Ok, I've saved you up a nice lil' #{Redwood::CONFIG_FN}."
+
say <<EOS
Ok. The final step is to import all your messages into the Sup index.