Skip to content
Browse files

Update log output for an invalid theme directory (#7679)

Merge pull request 7679
  • Loading branch information...
cetinajero authored and jekyllbot committed Jul 1, 2019
1 parent 6435bd6 commit ebe62e8a282c57b4408c29cf5081f709ac61a321
@@ -31,6 +31,7 @@ group :test do
gem "rubocop-performance"
gem "test-dependency-theme", :path => File.expand_path("test/fixtures/test-dependency-theme", __dir__)
gem "test-theme", :path => File.expand_path("test/fixtures/test-theme", __dir__)
gem "test-theme-skinny", :path => File.expand_path("test/fixtures/test-theme-skinny", __dir__)
gem "test-theme-symlink", :path => File.expand_path("test/fixtures/test-theme-symlink", __dir__)

gem "jruby-openssl" if RUBY_ENGINE == "jruby"
@@ -57,6 +57,17 @@ Feature: Writing themes
And I should see "From your site." in "_site/assets/"
And I should see "From your site." in "_site/assets/base.js"

Scenario: A theme with *just* layouts
Given I have a configuration file with "theme" set to "test-theme-skinny"
And I have an "index.html" page with layout "home" that contains "The quick brown fox."
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Message: The quick brown fox." in "_site/index.html"
But I should not see "_includes" in the build output
And I should not see "_sass" in the build output
And I should not see "assets" in the build output

Scenario: Requiring dependencies of a theme
Given I have a configuration file with "theme" set to "test-dependency-theme"
When I run jekyll build
@@ -62,11 +62,22 @@ def realpath_for(folder)
# escape the theme root.
# However, symlinks are allowed to point to other directories within the theme.
Jekyll.sanitized_path(root, File.realpath(Jekyll.sanitized_path(root, folder.to_s)))
rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP
Jekyll.logger.warn "Invalid theme folder:", folder
rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP => e
log_realpath_exception(e, folder)

def log_realpath_exception(err, folder)
return if err.is_a?(Errno::ENOENT)

case err
when Errno::EACCES
Jekyll.logger.error "Theme error:", "Directory '#{folder}' is not accessible."
when Errno::ELOOP
Jekyll.logger.error "Theme error:", "Directory '#{folder}' includes a symbolic link loop."

def gemspec
@gemspec ||= Gem::Specification.find_by_name(name)
rescue Gem::LoadError
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<h1>Hello World</h1>
{{ content }}
@@ -0,0 +1,5 @@
layout: default

Message: {{ content }}
@@ -0,0 +1,11 @@
# frozen_string_literal: true do |s| = "test-theme-skinny"
s.version = "0.1.0"
s.licenses = ["MIT"]
s.summary = "This is a theme with just layouts used to test Jekyll"
s.authors = ["Jekyll"]
s.files = ["lib/example.rb"]
s.homepage = ""

0 comments on commit ebe62e8

Please sign in to comment.
You can’t perform that action at this time.