bin/sup-config in sup-0.13.0 vs bin/sup-config in sup-0.13.1
- old
+ new
@@ -1,7 +1,9 @@
#!/usr/bin/env ruby
+$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
+
require 'rubygems'
require 'highline/import'
require 'trollop'
require "sup"
@@ -17,15 +19,16 @@
No options.
EOS
end
def axe q, default=nil
- ans = if default && !default.empty?
- ask "#{q} (enter for \"#{default}\"): "
- else
- ask "#{q}: "
- end
+ question = if default && !default.empty?
+ "#{q} (enter for \"#{default}\"): "
+ else
+ "#{q}: "
+ end
+ ans = ask question
ans.empty? ? default : ans.to_s
end
def axe_yes q, default="n"
axe(q, default) =~ /^y|yes$/i
@@ -34,10 +37,12 @@
def build_cmd cmd
(ENV["RUBY_INVOCATION"] ? ENV["RUBY_INVOCATION"] + " " : "") + File.join(File.dirname($0), cmd)
end
def add_source
+ require "sup/util/uri"
+
type = nil
say "Ok, adding a new source."
choose do |menu|
menu.prompt = "What type of mail source is it? "
@@ -67,10 +72,10 @@
[Redwood::Maildir.suggest_labels_for(fn),
{ :scheme => "maildir", :path => fn }]
end
uri = begin
- URI::Generic.build components
+ Redwood::Util::Uri.build components
rescue URI::Error => e
say "Whoopsie! I couldn't build a URI from that: #{e.message}"
if axe_yes("Try again?") then next else return end
end