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 module Jekyll
VERSION = '1.0.0.beta4' VERSION = '1.0.0.beta4'
extend Logger
# Public: Generate a Jekyll configuration Hash by merging the default # Public: Generate a Jekyll configuration Hash by merging the default
# options with anything in _config.yml, and adding the given options on top. # options with anything in _config.yml, and adding the given options on top.
# #

View File

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

View File

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

View File

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

View File

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

View File

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