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
rescue Jekyll::FatalException => e
puts
puts "ERROR: YOUR SITE COULD NOT BE BUILT:"
puts "------------------------------------"
puts e.message
Jekyll.warn "ERROR:", "YOUR SITE COULD NOT BE BUILT:"
Jekyll.warn "", "------------------------------------"
Jekyll.warn "", 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']
puts " Source: #{source}"
puts " Destination: #{destination}"
print " Generating... "
Jekyll.info "Source:", source
Jekyll.info "Destination:", destination
print Jekyll.formatted_topic "Generating..."
self.process_site(site)
puts "done."
end
@ -36,14 +36,14 @@ module Jekyll
source = options['source']
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.interval = 1
dw.add_observer do |*args|
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)
puts "...done."
end

View File

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