lib/cl/ui.rb in cl-0.1.12 vs lib/cl/ui.rb in cl-0.1.13
- old
+ new
@@ -15,13 +15,18 @@
def stdout
@stdout ||= opts[:stdout] || $stdout
end
- def puts(*str)
- stdout.puts(*str)
+ def puts(*strs)
+ stdout.puts(*strs)
end
+
+ def abort(error, *strs)
+ self.error [error.message, *strs].join("\n\n")
+ exit 1
+ end
end
class Silent < Base
%i(announce info notice warn error success cmd).each do |name|
define_method (name) { |*| }
@@ -35,9 +40,13 @@
end
end
def stdout
@stdout ||= StringIO.new
+ end
+
+ def abort(error, *strs)
+ raise error
end
end
class Pipe < Base
%i(announce info notice warn error).each do |name|