diff --git a/lib/jekyll/commands/doctor.rb b/lib/jekyll/commands/doctor.rb index 4e280a2d..d6b31205 100644 --- a/lib/jekyll/commands/doctor.rb +++ b/lib/jekyll/commands/doctor.rb @@ -30,6 +30,7 @@ module Jekyll def healthy?(site) [ + fsnotify_buggy?(site), !deprecated_relative_permalinks(site), !conflicting_urls(site) ].all? @@ -59,8 +60,23 @@ module Jekyll conflicting_urls end - private + def fsnotify_buggy?(site) + return true if !Utils::Platforms.osx? + if Dir.pwd != `pwd`.strip + Jekyll.logger.error " " + <<-STR.strip.gsub(/\n\s+/, "\n ") + We have detected that there might be trouble using fsevent on your + operating system, you can read https://github.com/thibaudgg/rb-fsevent/wiki/no-fsevents-fired-(OSX-bug) + for possible work arounds or you can work around it immediately + with `--force-polling`. + STR + false + end + + true + end + + private def collect_urls(urls, things, destination) things.each do |thing| dest = thing.destination(destination) diff --git a/lib/jekyll/utils.rb b/lib/jekyll/utils.rb index 39302790..cc01c8cc 100644 --- a/lib/jekyll/utils.rb +++ b/lib/jekyll/utils.rb @@ -1,6 +1,6 @@ module Jekyll - module Utils - extend self + module Utils extend self + autoload :Platforms, 'jekyll/utils/platforms' # Constants for use in #slugify SLUGIFY_MODES = %w{raw default pretty} diff --git a/lib/jekyll/utils/platforms.rb b/lib/jekyll/utils/platforms.rb new file mode 100644 index 00000000..83858a07 --- /dev/null +++ b/lib/jekyll/utils/platforms.rb @@ -0,0 +1,30 @@ +module Jekyll + module Utils + module Platforms extend self + + # Provides jruby? and mri? which respectively detect these two types of + # tested Engines we support, in the future we might probably support the + # other one that everyone used to talk about. + + { :jruby? => "jruby", :mri? => "ruby" }.each do |k, v| + define_method k do + ::RUBY_ENGINE == v + end + end + + # Provides windows?, linux?, osx?, unix? so that we can detect + # platforms. This is mostly useful for `jekyll doctor` and for testing + # where we kick off certain tests based on the platform. + + { :windows? => /mswin|mingw|cygwin/, :linux? => /linux/, \ + :osx? => /darwin|mac os/, :unix? => /solaris|bsd/ }.each do |k, v| + + define_method k do + !!( + RbConfig::CONFIG["host_os"] =~ v + ) + end + end + end + end +end