Add Jekyll::Stevenson#abort_with

This commit is contained in:
Parker Moore 2013-07-22 10:07:15 +02:00
parent 5fb13d8047
commit 374e6fcdf4
1 changed files with 15 additions and 4 deletions

View File

@ -22,7 +22,7 @@ module Jekyll
# message - the message detail # message - the message detail
# #
# Returns nothing # Returns nothing
def info(topic, message) def info(topic, message = nil)
$stdout.puts(message(topic, message)) if log_level <= INFO $stdout.puts(message(topic, message)) if log_level <= INFO
end end
@ -32,7 +32,7 @@ module Jekyll
# message - the message detail # message - the message detail
# #
# Returns nothing # Returns nothing
def warn(topic, message) def warn(topic, message = nil)
$stderr.puts(message(topic, message).yellow) if log_level <= WARN $stderr.puts(message(topic, message).yellow) if log_level <= WARN
end end
@ -42,10 +42,21 @@ module Jekyll
# message - the message detail # message - the message detail
# #
# Returns nothing # Returns nothing
def error(topic, message) def error(topic, message = nil)
$stderr.puts(message(topic, message).red) if log_level <= ERROR $stderr.puts(message(topic, message).red) if log_level <= ERROR
end end
# Public: Print a Jekyll error message to stderr and immediately abort the process
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
# message - the message detail (can be omitted)
#
# Returns nothing
def abort_with(topic, message = nil)
error(topic, message)
abort
end
# Public: Build a Jekyll topic method # Public: Build a Jekyll topic method
# #
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc. # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.