Move manual printing to Jekyll.info and Jekyll.warn

This commit is contained in:
Parker Moore 2013-04-13 18:22:34 +02:00
parent c5f6e527b5
commit 17f97cdbab
3 changed files with 14 additions and 15 deletions

View File

@ -18,9 +18,9 @@ module Jekyll
site.process site.process
rescue Jekyll::FatalException => e rescue Jekyll::FatalException => e
puts puts
puts "ERROR: YOUR SITE COULD NOT BE BUILT:" Jekyll.warn "ERROR:", "YOUR SITE COULD NOT BE BUILT:"
puts "------------------------------------" Jekyll.warn "", "------------------------------------"
puts e.message Jekyll.warn "", 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']
puts " Source: #{source}" Jekyll.info "Source:", source
puts " Destination: #{destination}" Jekyll.info "Destination:", destination
print " Generating... " print Jekyll.formatted_topic "Generating..."
self.process_site(site) self.process_site(site)
puts "done." puts "done."
end end
@ -36,14 +36,14 @@ module Jekyll
source = options['source'] source = options['source']
destination = options['destination'] destination = options['destination']
puts " Auto-regeneration: enabled" Jekyll.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
dw.add_observer do |*args| dw.add_observer do |*args|
t = Time.now.strftime("%Y-%m-%d %H:%M:%S") t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
print " Regenerating: #{args.size} files at #{t} " print Jekyll.formatted_topic("Regenerating:") + "#{args.size} files at #{t} "
self.process_site(site) self.process_site(site)
puts "...done." puts "...done."
end end

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}" if !next_config.is_a?(Hash) raise "Configuration file: (INVALID) #{file}" if !next_config.is_a?(Hash)
$stdout.puts "Configuration file: #{file}" Jekyll.info "Configuration file:", file
configuration.deep_merge(next_config) configuration.deep_merge(next_config)
end end
@ -123,12 +123,11 @@ module Jekyll
end end
rescue SystemCallError rescue SystemCallError
# Errno:ENOENT = file not found # Errno:ENOENT = file not found
$stderr.puts "Configuration file: none" Jekyll.warn "Configuration file:", "none"
rescue => err rescue => err
$stderr.puts " " + Jekyll.warn "WARNING", "Error reading configuration. " +
"WARNING: Error reading configuration. " +
"Using defaults (and options)." "Using defaults (and options)."
$stderr.puts "#{err}" Jekyll.warn "", "#{err}"
end end
configuration.backwards_compatibilize configuration.backwards_compatibilize
@ -141,8 +140,8 @@ module Jekyll
def backwards_compatibilize def backwards_compatibilize
config = dup config = dup
# Provide backwards-compatibility # Provide backwards-compatibility
if config['auto'] if config.has_key? 'auto'
$stderr.puts "Deprecation: ".rjust(20) + "'auto' has been changed to " + Jekyll.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