Remove Logger methods from main Jekyll module.

This commit is contained in:
Parker Moore 2013-04-14 19:27:19 +02:00
parent ef51b0f9e4
commit 4ef107f3e8
6 changed files with 20 additions and 22 deletions

View File

@ -58,8 +58,6 @@ SafeYAML::OPTIONS[:suppress_warnings] = true
module Jekyll
VERSION = '1.0.0.beta4'
extend Logger
# Public: Generate a Jekyll configuration Hash by merging the default
# options with anything in _config.yml, and adding the given options on top.
#

View File

@ -18,9 +18,9 @@ module Jekyll
site.process
rescue Jekyll::FatalException => e
puts
Jekyll.warn "ERROR:", "YOUR SITE COULD NOT BE BUILT:"
Jekyll.warn "", "------------------------------------"
Jekyll.warn "", e.message
Jekyll::Logger.error "ERROR:", "YOUR SITE COULD NOT BE BUILT:"
Jekyll::Logger.error "", "------------------------------------"
Jekyll::Logger.error "", e.message
exit(1)
end
end

View File

@ -17,9 +17,9 @@ module Jekyll
def self.build(site, options)
source = options['source']
destination = options['destination']
Jekyll.info "Source:", source
Jekyll.info "Destination:", destination
print Jekyll.formatted_topic "Generating..."
Jekyll::Logger.info "Source:", source
Jekyll::Logger.info "Destination:", destination
print Jekyll::Logger.formatted_topic "Generating..."
self.process_site(site)
puts "done."
end
@ -36,7 +36,7 @@ module Jekyll
source = options['source']
destination = options['destination']
Jekyll.info "Auto-regeneration:", "enabled"
Jekyll::Logger.info "Auto-regeneration:", "enabled"
dw = DirectoryWatcher.new(source, :glob => self.globs(source, destination), :pre_load => true)
dw.interval = 1

View File

@ -104,7 +104,7 @@ module Jekyll
configuration = dup
next_config = YAML.safe_load_file(file)
raise "Configuration file: (INVALID) #{file}".yellow if !next_config.is_a?(Hash)
Jekyll.info "Configuration file:", file
Jekyll::Logger.info "Configuration file:", file
configuration.deep_merge(next_config)
end
@ -123,9 +123,9 @@ module Jekyll
end
rescue SystemCallError
# Errno:ENOENT = file not found
Jekyll.warn "Configuration file:", "none"
Jekyll::Logger.warn "Configuration file:", "none"
rescue => err
Jekyll.warn "WARNING:", "Error reading configuration. " +
Jekyll::Logger.warn "WARNING:", "Error reading configuration. " +
"Using defaults (and options)."
$stderr.puts "#{err}"
end
@ -141,7 +141,7 @@ module Jekyll
config = dup
# Provide backwards-compatibility
if config.has_key? 'auto'
Jekyll.warn "Deprecation:", "'auto' has been changed to " +
Jekyll::Logger.warn "Deprecation:", "'auto' has been changed to " +
"'watch'. Please update your configuration to use 'watch'."
config['watch'] = config['auto']
end

View File

@ -17,7 +17,7 @@ module Jekyll
def self.deprecation_message(args, deprecated_argument, message)
if args.include?(deprecated_argument)
Jekyll.error "Deprecation:", message
Jekyll::Logger.error "Deprecation:", message
exit(1)
end
end

View File

@ -6,8 +6,8 @@ module Jekyll
# message - the message detail
#
# Returns nothing
def info(topic, message)
$stdout.puts Jekyll.message(topic, message)
def self.info(topic, message)
$stdout.puts message(topic, message)
end
# Public: Print a jekyll message to stderr
@ -16,8 +16,8 @@ module Jekyll
# message - the message detail
#
# Returns nothing
def warn(topic, message)
$stderr.puts (Jekyll.message(topic, message)).yellow
def self.warn(topic, message)
$stderr.puts message(topic, message).yellow
end
# Public: Print a jekyll error message to stderr
@ -26,8 +26,8 @@ module Jekyll
# message - the message detail
#
# Returns nothing
def error(topic, message)
$stderr.puts (Jekyll.message(topic, message)).red
def self.error(topic, message)
$stderr.puts message(topic, message).red
end
# Public: Build a Jekyll topic method
@ -36,7 +36,7 @@ module Jekyll
# message - the message detail
#
# Returns the formatted message
def message(topic, message)
def self.message(topic, message)
formatted_topic(topic) + message.gsub(/\s+/, ' ')
end
@ -45,7 +45,7 @@ module Jekyll
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
#
# Returns the formatted topic statement
def formatted_topic(topic)
def self.formatted_topic(topic)
"#{topic} ".rjust(20)
end
end