diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 4b385fb2..cbc0d3ae 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -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. # diff --git a/lib/jekyll/command.rb b/lib/jekyll/command.rb index a7678c30..a352028b 100644 --- a/lib/jekyll/command.rb +++ b/lib/jekyll/command.rb @@ -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 diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index a40d261f..e559ff4f 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -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 diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index e67300a7..074d13c3 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -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 diff --git a/lib/jekyll/deprecator.rb b/lib/jekyll/deprecator.rb index 642f6f48..88e959b7 100644 --- a/lib/jekyll/deprecator.rb +++ b/lib/jekyll/deprecator.rb @@ -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 diff --git a/lib/jekyll/logger.rb b/lib/jekyll/logger.rb index 6b30ad95..74a1bdc4 100644 --- a/lib/jekyll/logger.rb +++ b/lib/jekyll/logger.rb @@ -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