Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3653: Add a doctor helper to test pwd's. #3704

Merged
merged 1 commit into from May 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion lib/jekyll/commands/doctor.rb
Expand Up @@ -30,6 +30,7 @@ def process(options)

def healthy?(site)
[
fsnotify_buggy?(site),
!deprecated_relative_permalinks(site),
!conflicting_urls(site)
].all?
Expand Down Expand Up @@ -59,8 +60,23 @@ def conflicting_urls(site)
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)
Expand Down
4 changes: 2 additions & 2 deletions 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}
Expand Down
30 changes: 30 additions & 0 deletions 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