parent
6d777a2a21
commit
a28f54a59f
|
@ -88,9 +88,10 @@ Naming/HeredocDelimiterNaming:
|
|||
- test/**/*.rb
|
||||
Naming/MemoizedInstanceVariableName:
|
||||
Exclude:
|
||||
- lib/jekyll/page_without_a_file.rb
|
||||
- lib/jekyll/drops/unified_payload_drop.rb
|
||||
- lib/jekyll/convertible.rb
|
||||
- lib/jekyll/drops/site_drop.rb
|
||||
- lib/jekyll/drops/unified_payload_drop.rb
|
||||
- lib/jekyll/page_without_a_file.rb
|
||||
Naming/UncommunicativeMethodParamName:
|
||||
AllowedNames:
|
||||
- _
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -25,7 +25,7 @@ group :test do
|
|||
gem "nokogiri", "~> 1.7"
|
||||
gem "rspec"
|
||||
gem "rspec-mocks"
|
||||
gem "rubocop", "~> 0.57.2"
|
||||
gem "rubocop", "~> 0.59.0"
|
||||
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__)
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ module Jekyll
|
|||
# Returns cached value
|
||||
def [](key)
|
||||
return @cache[key] if @cache.key?(key)
|
||||
|
||||
path = path_to(hash(key))
|
||||
if @@disk_cache_enabled && File.file?(path) && File.readable?(path)
|
||||
@cache[key] = load(path)
|
||||
|
@ -57,6 +58,7 @@ module Jekyll
|
|||
def []=(key, value)
|
||||
@cache[key] = value
|
||||
return unless @@disk_cache_enabled
|
||||
|
||||
path = path_to(hash(key))
|
||||
dump(path, value)
|
||||
end
|
||||
|
@ -78,6 +80,7 @@ module Jekyll
|
|||
def delete(key)
|
||||
@cache.delete(key)
|
||||
return unless @@disk_cache_enabled
|
||||
|
||||
path = path_to(hash(key))
|
||||
File.delete(path)
|
||||
end
|
||||
|
@ -91,6 +94,7 @@ module Jekyll
|
|||
# Otherwise, it might be cached on disk
|
||||
# but we should not consider the disk cache if it is disabled
|
||||
return false unless @@disk_cache_enabled
|
||||
|
||||
path = path_to(hash(key))
|
||||
File.file?(path) && File.readable?(path)
|
||||
end
|
||||
|
@ -103,6 +107,7 @@ module Jekyll
|
|||
config = config.inspect
|
||||
cache = Jekyll::Cache.new "Jekyll::Cache"
|
||||
return if cache.key?("config") && cache["config"] == config
|
||||
|
||||
clear
|
||||
cache = Jekyll::Cache.new "Jekyll::Cache"
|
||||
cache["config"] = config
|
||||
|
@ -116,6 +121,7 @@ module Jekyll
|
|||
def path_to(hash = nil)
|
||||
@base_dir ||= File.join(@@base_dir, @name)
|
||||
return @base_dir if hash.nil?
|
||||
|
||||
File.join(@base_dir, hash[0..1], hash[2..-1]).freeze
|
||||
end
|
||||
|
||||
|
@ -145,6 +151,7 @@ module Jekyll
|
|||
# rubocop:disable Security/MarshalLoad
|
||||
def load(path)
|
||||
raise unless @@disk_cache_enabled
|
||||
|
||||
cached_file = File.open(path, "rb")
|
||||
value = Marshal.load(cached_file)
|
||||
cached_file.close
|
||||
|
@ -158,6 +165,7 @@ module Jekyll
|
|||
# Returns nothing.
|
||||
def dump(path, value)
|
||||
return unless @@disk_cache_enabled
|
||||
|
||||
dir = File.dirname(path)
|
||||
FileUtils.mkdir_p(dir)
|
||||
File.open(path, "wb") do |cached_file|
|
||||
|
|
|
@ -45,6 +45,7 @@ module Jekyll
|
|||
|
||||
Utils.safe_glob(site.in_dest_dir, ["**", "*"], File::FNM_DOTMATCH).each do |file|
|
||||
next if file =~ HIDDEN_FILE_REGEX || file =~ regex || dirs.include?(file)
|
||||
|
||||
files << file
|
||||
end
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ module Jekyll
|
|||
filtered_entries.each do |file_path|
|
||||
full_path = collection_dir(file_path)
|
||||
next if File.directory?(full_path)
|
||||
|
||||
if Utils.has_yaml_header? full_path
|
||||
read_document(full_path)
|
||||
else
|
||||
|
@ -73,6 +74,7 @@ module Jekyll
|
|||
# relative to the collection's directory
|
||||
def entries
|
||||
return [] unless exists?
|
||||
|
||||
@entries ||=
|
||||
Utils.safe_glob(collection_dir, ["**", "*"], File::FNM_DOTMATCH).map do |entry|
|
||||
entry["#{collection_dir}/"] = ""
|
||||
|
@ -86,6 +88,7 @@ module Jekyll
|
|||
# Returns a list of filtered entry paths.
|
||||
def filtered_entries
|
||||
return [] unless exists?
|
||||
|
||||
@filtered_entries ||=
|
||||
Dir.chdir(directory) do
|
||||
entry_filter.filter(entries).reject do |f|
|
||||
|
@ -124,6 +127,7 @@ module Jekyll
|
|||
# is stored on the filesystem.
|
||||
def collection_dir(*files)
|
||||
return directory if files.empty?
|
||||
|
||||
site.in_source_dir(container, relative_directory, *files)
|
||||
end
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ module Jekyll
|
|||
# Returns a full Jekyll configuration
|
||||
def configuration_from_options(options)
|
||||
return options if options.is_a?(Jekyll::Configuration)
|
||||
|
||||
Jekyll.configuration(options)
|
||||
end
|
||||
|
||||
|
|
|
@ -45,8 +45,10 @@ module Jekyll
|
|||
|
||||
def properly_gathered_posts?(site)
|
||||
return true if site.config["collections_dir"].empty?
|
||||
|
||||
posts_at_root = site.in_source_dir("_posts")
|
||||
return true unless File.directory?(posts_at_root)
|
||||
|
||||
Jekyll.logger.warn "Warning:",
|
||||
"Detected '_posts' directory outside custom `collections_dir`!"
|
||||
Jekyll.logger.warn "",
|
||||
|
@ -70,6 +72,7 @@ module Jekyll
|
|||
urls = collect_urls(urls, site.posts.docs, site.dest)
|
||||
urls.each do |url, paths|
|
||||
next unless paths.size > 1
|
||||
|
||||
conflicting_urls = true
|
||||
Jekyll.logger.warn "Conflict:", "The URL '#{url}' is the destination" \
|
||||
" for the following pages: #{paths.join(", ")}"
|
||||
|
@ -79,6 +82,7 @@ module Jekyll
|
|||
|
||||
def fsnotify_buggy?(_site)
|
||||
return true unless Utils::Platforms.osx?
|
||||
|
||||
if Dir.pwd != `pwd`.strip
|
||||
Jekyll.logger.error " " + <<-STR.strip.gsub(%r!\n\s+!, "\n ")
|
||||
We have detected that there might be trouble using fsevent on your
|
||||
|
@ -98,6 +102,7 @@ module Jekyll
|
|||
urls = case_insensitive_urls(site.pages + site.docs_to_write, site.dest)
|
||||
urls.each_value do |real_urls|
|
||||
next unless real_urls.uniq.size > 1
|
||||
|
||||
urls_only_differ_by_case = true
|
||||
Jekyll.logger.warn "Warning:", "The following URLs only differ" \
|
||||
" by case. On a case-insensitive file system one of the URLs" \
|
||||
|
@ -138,6 +143,7 @@ module Jekyll
|
|||
|
||||
def url_exists?(url)
|
||||
return true unless url.nil? || url.empty?
|
||||
|
||||
Jekyll.logger.warn "Warning:", "You didn't set an URL in the config file, "\
|
||||
"you may encounter problems with some plugins."
|
||||
false
|
||||
|
@ -156,6 +162,7 @@ module Jekyll
|
|||
|
||||
def url_absolute(url)
|
||||
return true if Addressable::URI.parse(url).absolute?
|
||||
|
||||
Jekyll.logger.warn "Warning:", "Your site URL does not seem to be absolute, "\
|
||||
"check the value of `url` in your config file."
|
||||
false
|
||||
|
|
|
@ -261,6 +261,7 @@ module Jekyll
|
|||
return system "start", address if Utils::Platforms.windows?
|
||||
return system "xdg-open", address if Utils::Platforms.linux?
|
||||
return system "open", address if Utils::Platforms.osx?
|
||||
|
||||
Jekyll.logger.error "Refusing to launch browser; " \
|
||||
"Platform launcher unknown."
|
||||
end
|
||||
|
|
|
@ -196,6 +196,7 @@ module Jekyll
|
|||
begin
|
||||
files.each do |config_file|
|
||||
next if config_file.nil? || config_file.empty?
|
||||
|
||||
new_config = read_config_file(config_file)
|
||||
configuration = Utils.deep_merge_hashes(configuration, new_config)
|
||||
end
|
||||
|
|
|
@ -9,6 +9,7 @@ module Jekyll
|
|||
|
||||
def setup
|
||||
return if @setup ||= false
|
||||
|
||||
unless (@parser = get_processor)
|
||||
Jekyll.logger.error "Invalid Markdown processor given:", @config["markdown"]
|
||||
Jekyll.logger.info "", "Custom processors are not loaded in safe mode" if @config["safe"]
|
||||
|
|
|
@ -161,6 +161,7 @@ module Jekyll
|
|||
# Returns true if the file has Liquid Tags or Variables, false otherwise.
|
||||
def render_with_liquid?
|
||||
return false if data["render_with_liquid"] == false
|
||||
|
||||
Jekyll::Utils.has_liquid_construct?(content)
|
||||
end
|
||||
|
||||
|
|
|
@ -160,6 +160,7 @@ module Jekyll
|
|||
# true otherwise.
|
||||
def render_with_liquid?
|
||||
return false if data["render_with_liquid"] == false
|
||||
|
||||
!(coffeescript_file? || yaml_file? || !Utils.has_liquid_construct?(content))
|
||||
end
|
||||
|
||||
|
@ -304,6 +305,7 @@ module Jekyll
|
|||
# equal or greater than the other doc's path. See String#<=> for more details.
|
||||
def <=>(other)
|
||||
return nil unless other.respond_to?(:data)
|
||||
|
||||
cmp = data["date"] <=> other.data["date"]
|
||||
cmp = path <=> other.path if cmp.nil? || cmp.zero?
|
||||
cmp
|
||||
|
|
|
@ -26,6 +26,7 @@ module Jekyll
|
|||
|
||||
def <=>(other)
|
||||
return nil unless other.is_a? DocumentDrop
|
||||
|
||||
cmp = self["date"] <=> other["date"]
|
||||
cmp = self["path"] <=> other["path"] if cmp.nil? || cmp.zero?
|
||||
cmp
|
||||
|
|
|
@ -101,6 +101,7 @@ module Jekyll
|
|||
def key?(key)
|
||||
return false if key.nil?
|
||||
return true if self.class.mutable? && @mutations.key?(key)
|
||||
|
||||
respond_to?(key) || fallback_data.key?(key)
|
||||
end
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ module Jekyll
|
|||
# We should remove this in 4.0 and switch to `{{ post.related_posts }}`.
|
||||
def related_posts
|
||||
return nil unless @current_document.is_a?(Jekyll::Document)
|
||||
|
||||
@current_document.related_posts
|
||||
end
|
||||
attr_writer :current_document
|
||||
|
|
|
@ -35,6 +35,7 @@ module Jekyll
|
|||
next true if symlink?(e)
|
||||
# Do not reject this entry if it is included.
|
||||
next false if included?(e)
|
||||
|
||||
# Reject this entry if it is special, a backup file, or excluded.
|
||||
special?(e) || backup?(e) || excluded?(e)
|
||||
end
|
||||
|
|
|
@ -90,6 +90,7 @@ module Jekyll
|
|||
|
||||
def render_with_liquid?
|
||||
return false if data["render_with_liquid"] == false
|
||||
|
||||
!(coffeescript_file? || yaml_file? || !Utils.has_liquid_construct?(content))
|
||||
end
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ module Jekyll
|
|||
# RubyGems.
|
||||
def version_constraint(gem_name)
|
||||
return "= #{Jekyll::VERSION}" if gem_name.to_s.eql?("jekyll-docs")
|
||||
|
||||
"> 0"
|
||||
end
|
||||
|
||||
|
|
|
@ -169,6 +169,7 @@ module Jekyll
|
|||
def where(input, property, value)
|
||||
return input if property.nil? || value.nil?
|
||||
return input unless input.respond_to?(:select)
|
||||
|
||||
input = input.values if input.is_a?(Hash)
|
||||
input_id = input.hash
|
||||
|
||||
|
@ -195,6 +196,7 @@ module Jekyll
|
|||
# Returns the filtered array of objects
|
||||
def where_exp(input, variable, expression)
|
||||
return input unless input.respond_to?(:select)
|
||||
|
||||
input = input.values if input.is_a?(Hash) # FIXME
|
||||
|
||||
condition = parse_condition(expression)
|
||||
|
@ -214,6 +216,7 @@ module Jekyll
|
|||
def to_integer(input)
|
||||
return 1 if input == true
|
||||
return 0 if input == false
|
||||
|
||||
input.to_i
|
||||
end
|
||||
|
||||
|
@ -226,6 +229,7 @@ module Jekyll
|
|||
# Returns the filtered array of objects
|
||||
def sort(input, property = nil, nils = "first")
|
||||
raise ArgumentError, "Cannot sort a null object." if input.nil?
|
||||
|
||||
if property.nil?
|
||||
input.sort
|
||||
else
|
||||
|
@ -244,6 +248,7 @@ module Jekyll
|
|||
|
||||
def pop(array, num = 1)
|
||||
return array unless array.is_a?(Array)
|
||||
|
||||
num = Liquid::Utils.to_integer(num)
|
||||
new_ary = array.dup
|
||||
new_ary.pop(num)
|
||||
|
@ -252,6 +257,7 @@ module Jekyll
|
|||
|
||||
def push(array, input)
|
||||
return array unless array.is_a?(Array)
|
||||
|
||||
new_ary = array.dup
|
||||
new_ary.push(input)
|
||||
new_ary
|
||||
|
@ -259,6 +265,7 @@ module Jekyll
|
|||
|
||||
def shift(array, num = 1)
|
||||
return array unless array.is_a?(Array)
|
||||
|
||||
num = Liquid::Utils.to_integer(num)
|
||||
new_ary = array.dup
|
||||
new_ary.shift(num)
|
||||
|
@ -267,6 +274,7 @@ module Jekyll
|
|||
|
||||
def unshift(array, input)
|
||||
return array unless array.is_a?(Array)
|
||||
|
||||
new_ary = array.dup
|
||||
new_ary.unshift(input)
|
||||
new_ary
|
||||
|
@ -274,6 +282,7 @@ module Jekyll
|
|||
|
||||
def sample(input, num = 1)
|
||||
return input unless input.respond_to?(:sample)
|
||||
|
||||
num = Liquid::Utils.to_integer(num) rescue 1
|
||||
if num == 1
|
||||
input.sample
|
||||
|
@ -330,6 +339,7 @@ module Jekyll
|
|||
def parse_sort_input(property)
|
||||
number_like = %r!\A\s*-?(?:\d+\.?\d*|\.\d+)\s*\Z!
|
||||
return property.to_f if property =~ number_like
|
||||
|
||||
property
|
||||
end
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ module Jekyll
|
|||
# Returns the formatted String.
|
||||
def date_to_xmlschema(date)
|
||||
return date if date.to_s.empty?
|
||||
|
||||
time(date).xmlschema
|
||||
end
|
||||
|
||||
|
@ -60,6 +61,7 @@ module Jekyll
|
|||
# Returns the formatted String.
|
||||
def date_to_rfc822(date)
|
||||
return date if date.to_s.empty?
|
||||
|
||||
time(date).rfc822
|
||||
end
|
||||
|
||||
|
@ -72,11 +74,13 @@ module Jekyll
|
|||
# Returns a stringified date or the empty input.
|
||||
def stringify_date(date, month_type, type = nil, style = nil)
|
||||
return date if date.to_s.empty?
|
||||
|
||||
time = time(date)
|
||||
if type == "ordinal"
|
||||
day = time.day
|
||||
ordinal_day = "#{day}#{ordinal(day)}"
|
||||
return time.strftime("#{month_type} #{ordinal_day}, %Y") if style == "US"
|
||||
|
||||
return time.strftime("#{ordinal_day} #{month_type} %Y")
|
||||
end
|
||||
time.strftime("%d #{month_type} %Y")
|
||||
|
|
|
@ -10,10 +10,13 @@ module Jekyll
|
|||
# Returns the absolute URL as a String.
|
||||
def absolute_url(input)
|
||||
return if input.nil?
|
||||
|
||||
input = input.url if input.respond_to?(:url)
|
||||
return input if Addressable::URI.parse(input.to_s).absolute?
|
||||
|
||||
site = @context.registers[:site]
|
||||
return relative_url(input) if site.config["url"].nil?
|
||||
|
||||
Addressable::URI.parse(
|
||||
site.config["url"].to_s + relative_url(input)
|
||||
).normalize.to_s
|
||||
|
@ -27,6 +30,7 @@ module Jekyll
|
|||
# Returns a URL relative to the domain root as a String.
|
||||
def relative_url(input)
|
||||
return if input.nil?
|
||||
|
||||
input = input.url if input.respond_to?(:url)
|
||||
return input if Addressable::URI.parse(input.to_s).absolute?
|
||||
|
||||
|
@ -43,6 +47,7 @@ module Jekyll
|
|||
# Returns a URL with the trailing `/index.html` removed
|
||||
def strip_index(input)
|
||||
return if input.nil? || input.to_s.empty?
|
||||
|
||||
input.sub(%r!/index\.html?$!, "/")
|
||||
end
|
||||
|
||||
|
@ -55,6 +60,7 @@ module Jekyll
|
|||
|
||||
def ensure_leading_slash(input)
|
||||
return input if input.nil? || input.empty? || input.start_with?("/")
|
||||
|
||||
"/#{input}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,6 +36,7 @@ module Jekyll
|
|||
def ensure_time!(set)
|
||||
return set unless set.key?("values") && set["values"].key?("date")
|
||||
return set if set["values"]["date"].is_a?(Time)
|
||||
|
||||
set["values"]["date"] = Utils.parse_date(
|
||||
set["values"]["date"],
|
||||
"An invalid date format was found in a front-matter default set: #{set}"
|
||||
|
@ -132,6 +133,7 @@ module Jekyll
|
|||
collections_dir = @site.config["collections_dir"]
|
||||
slashed_coll_dir = "#{collections_dir}/"
|
||||
return path if collections_dir.empty? || !path.to_s.start_with?(slashed_coll_dir)
|
||||
|
||||
path.sub(slashed_coll_dir, "")
|
||||
end
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ module Jekyll
|
|||
# Ensure the priority is a Fixnum
|
||||
def self.priority_value(priority)
|
||||
return priority if priority.is_a?(Integer)
|
||||
|
||||
PRIORITY_MAP[priority] || DEFAULT_PRIORITY
|
||||
end
|
||||
|
||||
|
|
|
@ -144,6 +144,7 @@ module Jekyll
|
|||
# the appropriate writer method, e.g. writer.info.
|
||||
def write(level_of_message, topic, message = nil, &block)
|
||||
return false unless write_message?(level_of_message)
|
||||
|
||||
writer.public_send(level_of_message, message(topic, message, &block))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,8 +37,10 @@ module Jekyll
|
|||
# Returns false only if no dependencies have been specified, otherwise nothing.
|
||||
def require_theme_deps
|
||||
return false unless site.theme.runtime_dependencies
|
||||
|
||||
site.theme.runtime_dependencies.each do |dep|
|
||||
next if dep.name == "jekyll"
|
||||
|
||||
External.require_with_graceful_fail(dep.name) if plugin_allowed?(dep.name)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -61,6 +61,7 @@ module Jekyll
|
|||
# Returns nothing.
|
||||
def retrieve_posts(dir)
|
||||
return if outside_configured_directory?(dir)
|
||||
|
||||
site.posts.docs.concat(post_reader.read_posts(dir))
|
||||
site.posts.docs.concat(post_reader.read_drafts(dir)) if site.show_drafts
|
||||
end
|
||||
|
@ -124,6 +125,7 @@ module Jekyll
|
|||
def get_entries(dir, subfolder)
|
||||
base = site.in_source_dir(dir, subfolder)
|
||||
return [] unless File.exist?(base)
|
||||
|
||||
entries = Dir.chdir(base) { filter_entries(Dir["**/*"], base) }
|
||||
entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }
|
||||
end
|
||||
|
|
|
@ -54,6 +54,7 @@ module Jekyll
|
|||
|
||||
def within(directory)
|
||||
return unless File.exist?(directory)
|
||||
|
||||
Dir.chdir(directory) { yield }
|
||||
end
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ module Jekyll
|
|||
def read_content(dir, magic_dir, matcher)
|
||||
@site.reader.get_entries(dir, magic_dir).map do |entry|
|
||||
next unless entry =~ matcher
|
||||
|
||||
path = @site.in_source_dir(File.join(dir, magic_dir, entry))
|
||||
Document.new(path,
|
||||
:site => @site,
|
||||
|
|
|
@ -12,6 +12,7 @@ module Jekyll
|
|||
|
||||
Find.find(site.theme.assets_path) do |path|
|
||||
next if File.directory?(path)
|
||||
|
||||
if File.symlink?(path)
|
||||
Jekyll.logger.warn "Theme reader:", "Ignored symlinked asset: #{path}"
|
||||
else
|
||||
|
|
|
@ -21,6 +21,7 @@ module Jekyll
|
|||
# Returns a boolean.
|
||||
def regenerate?(document)
|
||||
return true if disabled
|
||||
|
||||
case document
|
||||
when Page
|
||||
regenerate_page?(document)
|
||||
|
|
|
@ -158,10 +158,10 @@ module Jekyll
|
|||
output = render_layout(output, layout, info)
|
||||
add_regenerator_dependencies(layout)
|
||||
|
||||
if (layout = site.layouts[layout.data["layout"]])
|
||||
break if used.include?(layout)
|
||||
used << layout
|
||||
end
|
||||
next unless (layout = site.layouts[layout.data["layout"]])
|
||||
break if used.include?(layout)
|
||||
|
||||
used << layout
|
||||
end
|
||||
output
|
||||
end
|
||||
|
@ -202,6 +202,7 @@ module Jekyll
|
|||
|
||||
def add_regenerator_dependencies(layout)
|
||||
return unless document.write?
|
||||
|
||||
site.regenerator.add_dependency(
|
||||
site.in_source_dir(document.path),
|
||||
layout.path
|
||||
|
|
|
@ -377,6 +377,7 @@ module Jekyll
|
|||
# Returns a path which is prefixed with the theme root directory.
|
||||
def in_theme_dir(*paths)
|
||||
return nil unless theme
|
||||
|
||||
paths.reduce(theme.root) do |base, path|
|
||||
Jekyll.sanitized_path(base, path)
|
||||
end
|
||||
|
@ -474,6 +475,7 @@ module Jekyll
|
|||
|
||||
def render_regenerated(document, payload)
|
||||
return unless regenerator.regenerate?(document)
|
||||
|
||||
document.output = Jekyll::Renderer.new(self, document, payload).run
|
||||
document.trigger_hooks(:post_render)
|
||||
end
|
||||
|
|
|
@ -98,6 +98,7 @@ module Jekyll
|
|||
dest_path = destination(dest)
|
||||
|
||||
return false if File.exist?(dest_path) && !modified?
|
||||
|
||||
self.class.mtimes[path] = mtime
|
||||
|
||||
FileUtils.mkdir_p(File.dirname(dest_path))
|
||||
|
|
|
@ -17,6 +17,7 @@ module Jekyll
|
|||
@logdev = logdevice(severity)
|
||||
|
||||
return true if @logdev.nil? || severity < @level
|
||||
|
||||
progname ||= @progname
|
||||
if message.nil?
|
||||
if block_given?
|
||||
|
|
|
@ -83,6 +83,7 @@ module Jekyll
|
|||
|
||||
site.posts.docs.each do |p|
|
||||
next unless @post.deprecated_equality p
|
||||
|
||||
Jekyll::Deprecator.deprecation_message "A call to "\
|
||||
"'{% post_url #{@post.name} %}' did not match " \
|
||||
"a post using the new matching method of checking name " \
|
||||
|
|
|
@ -40,6 +40,7 @@ module Jekyll
|
|||
|
||||
def configure_sass
|
||||
return unless sass_path
|
||||
|
||||
External.require_with_graceful_fail("sass") unless defined?(Sass)
|
||||
Sass.load_paths << sass_path
|
||||
end
|
||||
|
|
|
@ -68,6 +68,7 @@ module Jekyll
|
|||
def generate_url_from_hash(template)
|
||||
@placeholders.inject(template) do |result, token|
|
||||
break result if result.index(":").nil?
|
||||
|
||||
if token.last.nil?
|
||||
# Remove leading "/" to avoid generating urls with `//`
|
||||
result.gsub("/:#{token.first}", "")
|
||||
|
|
|
@ -152,6 +152,7 @@ module Jekyll
|
|||
# Returns true is the string contains sequences of `{%` or `{{`
|
||||
def has_liquid_construct?(content)
|
||||
return false if content.nil? || content.empty?
|
||||
|
||||
content.include?("{%") || content.include?("{{")
|
||||
end
|
||||
# rubocop: enable PredicateName
|
||||
|
@ -292,8 +293,10 @@ module Jekyll
|
|||
# Returns matched pathes
|
||||
def safe_glob(dir, patterns, flags = 0)
|
||||
return [] unless Dir.exist?(dir)
|
||||
|
||||
pattern = File.join(Array(patterns))
|
||||
return [dir] if pattern.empty?
|
||||
|
||||
Dir.chdir(dir) do
|
||||
Dir.glob(pattern, flags).map { |f| File.join(dir, f) }
|
||||
end
|
||||
|
|
|
@ -70,13 +70,12 @@ module Jekyll
|
|||
private
|
||||
|
||||
def proc_version
|
||||
@proc_version ||= begin
|
||||
Pathutil.new(
|
||||
"/proc/version"
|
||||
).read
|
||||
rescue Errno::ENOENT
|
||||
nil
|
||||
end
|
||||
@proc_version ||=
|
||||
begin
|
||||
Pathutil.new("/proc/version").read
|
||||
rescue Errno::ENOENT
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -42,6 +42,7 @@ class TestRegenerator < JekyllUnitTest
|
|||
# because regenerate? checks if the destination exists
|
||||
[@page, @post, @document, @asset_file].each do |item|
|
||||
next unless item.respond_to?(:destination)
|
||||
|
||||
dest = item.destination(@site.dest)
|
||||
FileUtils.mkdir_p(File.dirname(dest))
|
||||
FileUtils.touch(dest)
|
||||
|
|
Loading…
Reference in New Issue