mirror of
https://github.com/jekyll/jekyll.git
synced 2026-01-09 15:08:08 -05:00
@@ -30,8 +30,8 @@ module Jekyll
|
||||
site = Jekyll::Site.new(options)
|
||||
|
||||
if options.fetch("skip_initial_build", false)
|
||||
Jekyll.logger.warn "Build Warning:", "Skipping the initial build." \
|
||||
" This may result in an out-of-date site."
|
||||
Jekyll.logger.warn "Build Warning:",
|
||||
"Skipping the initial build. This may result in an out-of-date site."
|
||||
else
|
||||
build(site, options)
|
||||
end
|
||||
|
||||
@@ -7,8 +7,7 @@ module Jekyll
|
||||
def init_with_program(prog)
|
||||
prog.command(:clean) do |c|
|
||||
c.syntax "clean [subcommand]"
|
||||
c.description "Clean the site " \
|
||||
"(removes site output and metadata file) without building."
|
||||
c.description "Clean the site (removes site output and metadata file) without building."
|
||||
|
||||
add_build_options(c)
|
||||
|
||||
|
||||
@@ -53,14 +53,14 @@ module Jekyll
|
||||
"Detected '_posts' directory outside custom `collections_dir`!"
|
||||
Jekyll.logger.warn "",
|
||||
"Please move '#{posts_at_root}' into the custom directory at " \
|
||||
"'#{site.in_source_dir(site.config["collections_dir"])}'"
|
||||
"'#{site.in_source_dir(site.config["collections_dir"])}'"
|
||||
false
|
||||
end
|
||||
|
||||
def deprecated_relative_permalinks(site)
|
||||
if site.config["relative_permalinks"]
|
||||
Jekyll::Deprecator.deprecation_message "Your site still uses relative permalinks," \
|
||||
" which was removed in Jekyll v3.0.0."
|
||||
Jekyll::Deprecator.deprecation_message "Your site still uses relative permalinks, " \
|
||||
"which was removed in Jekyll v3.0.0."
|
||||
true
|
||||
end
|
||||
end
|
||||
@@ -105,9 +105,9 @@ module Jekyll
|
||||
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" \
|
||||
" will be overwritten by the other: #{real_urls.join(", ")}"
|
||||
Jekyll.logger.warn "Warning:", "The following URLs only differ by case. On a " \
|
||||
"case-insensitive file system one of the URLs will be " \
|
||||
"overwritten by the other: #{real_urls.join(", ")}"
|
||||
end
|
||||
urls_only_differ_by_case
|
||||
end
|
||||
@@ -148,8 +148,8 @@ 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."
|
||||
Jekyll.logger.warn "Warning:", "You didn't set an URL in the config file, you may " \
|
||||
"encounter problems with some plugins."
|
||||
false
|
||||
end
|
||||
|
||||
@@ -159,16 +159,16 @@ module Jekyll
|
||||
# Addressable::URI#parse only raises a TypeError
|
||||
# https://github.com/sporkmonger/addressable/blob/0a0e96acb17225f9b1c9cab0bad332b448934c9a/lib/addressable/uri.rb#L103
|
||||
rescue TypeError
|
||||
Jekyll.logger.warn "Warning:", "The site URL does not seem to be valid, "\
|
||||
"check the value of `url` in your config file."
|
||||
Jekyll.logger.warn "Warning:", "The site URL does not seem to be valid, " \
|
||||
"check the value of `url` in your config file."
|
||||
false
|
||||
end
|
||||
|
||||
def url_absolute(url)
|
||||
return true if url.is_a?(String) && 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."
|
||||
Jekyll.logger.warn "Warning:", "Your site URL does not seem to be absolute, " \
|
||||
"check the value of `url` in your config file."
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,8 +28,8 @@ module Jekyll
|
||||
FileUtils.mkdir_p new_blog_path
|
||||
if preserve_source_location?(new_blog_path, options)
|
||||
Jekyll.logger.error "Conflict:", "#{new_blog_path} exists and is not empty."
|
||||
Jekyll.logger.abort_with "", "Ensure #{new_blog_path} is empty or else " \
|
||||
"try again with `--force` to proceed and overwrite any files."
|
||||
Jekyll.logger.abort_with "", "Ensure #{new_blog_path} is empty or else try again " \
|
||||
"with `--force` to proceed and overwrite any files."
|
||||
end
|
||||
|
||||
if options["blank"]
|
||||
@@ -108,13 +108,9 @@ module Jekyll
|
||||
def create_site(new_blog_path)
|
||||
create_sample_files new_blog_path
|
||||
|
||||
File.open(File.expand_path(initialized_post_name, new_blog_path), "w") do |f|
|
||||
f.write(scaffold_post_content)
|
||||
end
|
||||
File.write(File.expand_path(initialized_post_name, new_blog_path), scaffold_post_content)
|
||||
|
||||
File.open(File.expand_path("Gemfile", new_blog_path), "w") do |f|
|
||||
f.write(gemfile_contents)
|
||||
end
|
||||
File.write(File.expand_path("Gemfile", new_blog_path), gemfile_contents)
|
||||
end
|
||||
|
||||
def preserve_source_location?(path, options)
|
||||
|
||||
@@ -10,8 +10,7 @@ module Jekyll
|
||||
prog.command(:"new-theme") do |c|
|
||||
c.syntax "new-theme NAME"
|
||||
c.description "Creates a new Jekyll theme scaffold"
|
||||
c.option "code_of_conduct", \
|
||||
"-c", "--code-of-conduct", \
|
||||
c.option "code_of_conduct", "-c", "--code-of-conduct",
|
||||
"Include a Code of Conduct. (defaults to false)"
|
||||
|
||||
c.action do |args, opts|
|
||||
@@ -30,8 +29,8 @@ module Jekyll
|
||||
Jekyll.logger.abort_with "Conflict:", "#{theme.path} already exists." if theme.path.exist?
|
||||
|
||||
theme.create!
|
||||
Jekyll.logger.info "Your new Jekyll theme, #{theme.name.cyan}," \
|
||||
" is ready for you in #{theme.path.to_s.cyan}!"
|
||||
Jekyll.logger.info "Your new Jekyll theme, #{theme.name.cyan}, " \
|
||||
"is ready for you in #{theme.path.to_s.cyan}!"
|
||||
Jekyll.logger.info "For help getting started, read #{theme.path}/README.md."
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,11 +21,11 @@ module Jekyll
|
||||
"ssl_key" => ["--ssl-key [KEY]", "X.509 (SSL) Private Key."],
|
||||
"port" => ["-P", "--port [PORT]", "Port to listen on"],
|
||||
"show_dir_listing" => ["--show-dir-listing",
|
||||
"Show a directory listing instead of loading" \
|
||||
" your index file.",],
|
||||
"Show a directory listing instead of loading " \
|
||||
"your index file.",],
|
||||
"skip_initial_build" => ["skip_initial_build", "--skip-initial-build",
|
||||
"Skips the initial site build which occurs before" \
|
||||
" the server is started.",],
|
||||
"Skips the initial site build which occurs before " \
|
||||
"the server is started.",],
|
||||
"livereload" => ["-l", "--livereload",
|
||||
"Use LiveReload to automatically refresh browsers",],
|
||||
"livereload_ignore" => ["--livereload-ignore ignore GLOB1[,GLOB2[,...]]",
|
||||
@@ -113,8 +113,8 @@ module Jekyll
|
||||
def validate_options(opts)
|
||||
if opts["livereload"]
|
||||
if opts["detach"]
|
||||
Jekyll.logger.warn "Warning:", "--detach and --livereload are mutually exclusive." \
|
||||
" Choosing --livereload"
|
||||
Jekyll.logger.warn "Warning:", "--detach and --livereload are mutually exclusive. " \
|
||||
"Choosing --livereload"
|
||||
opts["detach"] = false
|
||||
end
|
||||
if opts["ssl_cert"] || opts["ssl_key"]
|
||||
@@ -132,9 +132,9 @@ module Jekyll
|
||||
livereload_max_delay
|
||||
livereload_ignore
|
||||
livereload_port).any? { |o| opts[o] }
|
||||
Jekyll.logger.abort_with "--livereload-min-delay, "\
|
||||
"--livereload-max-delay, --livereload-ignore, and "\
|
||||
"--livereload-port require the --livereload option."
|
||||
Jekyll.logger.abort_with "--livereload-min-delay, --livereload-max-delay, " \
|
||||
"--livereload-ignore, and --livereload-port require " \
|
||||
"the --livereload option."
|
||||
end
|
||||
end
|
||||
|
||||
@@ -174,7 +174,8 @@ module Jekyll
|
||||
# Do a base pre-setup of WEBRick so that everything is in place
|
||||
# when we get ready to party, checking for an setting up an error page
|
||||
# and making sure our destination exists.
|
||||
|
||||
#
|
||||
# rubocop:disable Security/IoMethods
|
||||
def setup(destination)
|
||||
require_relative "serve/servlet"
|
||||
|
||||
@@ -188,6 +189,7 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
end
|
||||
# rubocop:enable Security/IoMethods
|
||||
|
||||
def webrick_opts(opts)
|
||||
opts = {
|
||||
@@ -263,8 +265,7 @@ module Jekyll
|
||||
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."
|
||||
Jekyll.logger.error "Refusing to launch browser. Platform launcher unknown."
|
||||
end
|
||||
|
||||
# Keep in our area with a thread or detach the server as requested
|
||||
@@ -277,9 +278,8 @@ module Jekyll
|
||||
end
|
||||
|
||||
Process.detach(pid)
|
||||
Jekyll.logger.info "Server detached with pid '#{pid}'.", \
|
||||
"Run `pkill -f jekyll' or `kill -9 #{pid}'" \
|
||||
" to stop the server."
|
||||
Jekyll.logger.info "Server detached with pid '#{pid}'.",
|
||||
"Run `pkill -f jekyll' or `kill -9 #{pid}' to stop the server."
|
||||
else
|
||||
t = Thread.new { server.start }
|
||||
trap("INT") { server.shutdown }
|
||||
|
||||
@@ -110,7 +110,7 @@ module Jekyll
|
||||
|
||||
def log_error(error)
|
||||
Jekyll.logger.error "LiveReload experienced an error. " \
|
||||
"Run with --trace for more information."
|
||||
"Run with --trace for more information."
|
||||
raise error
|
||||
end
|
||||
end
|
||||
|
||||
@@ -128,7 +128,7 @@ module Jekyll
|
||||
class Servlet < WEBrick::HTTPServlet::FileHandler
|
||||
DEFAULTS = {
|
||||
"Cache-Control" => "private, max-age=0, proxy-revalidate, " \
|
||||
"no-store, no-cache, must-revalidate",
|
||||
"no-store, no-cache, must-revalidate",
|
||||
}.freeze
|
||||
|
||||
def initialize(server, root, callbacks)
|
||||
|
||||
@@ -304,8 +304,8 @@ module Jekyll
|
||||
return if config["plugins"].is_a?(Array)
|
||||
|
||||
Jekyll.logger.error "'plugins' should be set as an array of gem-names, but was: " \
|
||||
"#{config["plugins"].inspect}. Use 'plugins_dir' instead to set the directory " \
|
||||
"for your non-gemified Ruby plugins."
|
||||
"#{config["plugins"].inspect}. Use 'plugins_dir' instead to set " \
|
||||
"the directory for your non-gemified Ruby plugins."
|
||||
raise Jekyll::Errors::InvalidConfigurationError,
|
||||
"'plugins' should be set as an array, but was: #{config["plugins"].inspect}."
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Frozen-string-literal: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Kramdown
|
||||
# A Kramdown::Document subclass meant to optimize memory usage from initializing
|
||||
|
||||
@@ -190,8 +190,8 @@ module Jekyll
|
||||
|
||||
def print_build_warning
|
||||
Jekyll.logger.warn "Warning:", "Excerpt modified in #{doc.relative_path}!"
|
||||
Jekyll.logger.warn "", "Found a Liquid block containing the excerpt separator" \
|
||||
" #{doc.excerpt_separator.inspect}. "
|
||||
Jekyll.logger.warn "", "Found a Liquid block containing the excerpt separator " \
|
||||
"#{doc.excerpt_separator.inspect}."
|
||||
Jekyll.logger.warn "", "The block has been modified with the appropriate closing tag."
|
||||
Jekyll.logger.warn "", "Feel free to define a custom excerpt or excerpt_separator in the"
|
||||
Jekyll.logger.warn "", "document's Front Matter if the generated excerpt is unsatisfactory."
|
||||
|
||||
@@ -311,7 +311,7 @@ module Jekyll
|
||||
order = + 1
|
||||
else
|
||||
raise ArgumentError, "Invalid nils order: " \
|
||||
"'#{nils}' is not a valid nils order. It must be 'first' or 'last'."
|
||||
"'#{nils}' is not a valid nils order. It must be 'first' or 'last'."
|
||||
end
|
||||
|
||||
sort_input(input, property, order)
|
||||
|
||||
@@ -78,8 +78,8 @@ module Jekyll
|
||||
}
|
||||
|
||||
unless @registry[owner][event]
|
||||
raise NotAvailable, "Invalid hook. #{owner} supports only the " \
|
||||
"following hooks #{@registry[owner].keys.inspect}"
|
||||
raise NotAvailable, "Invalid hook. #{owner} supports only the following hooks " \
|
||||
"#{@registry[owner].keys.inspect}"
|
||||
end
|
||||
|
||||
raise Uncallable, "Hooks must respond to :call" unless block.respond_to? :call
|
||||
|
||||
@@ -113,9 +113,10 @@ module Jekyll
|
||||
pagination_included = (site.config["plugins"] || []).include?("jekyll-paginate") ||
|
||||
defined?(Jekyll::Paginate)
|
||||
if site.config["paginate"] && !pagination_included
|
||||
Jekyll::Deprecator.deprecation_message "You appear to have pagination " \
|
||||
"turned on, but you haven't included the `jekyll-paginate` gem. " \
|
||||
"Ensure you have `plugins: [jekyll-paginate]` in your configuration file."
|
||||
Jekyll::Deprecator.deprecation_message <<~MSG
|
||||
You appear to have pagination turned on, but you haven't included the `jekyll-paginate`
|
||||
gem. Ensure you have `plugins: [jekyll-paginate]` in your configuration file.
|
||||
MSG
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -105,7 +105,7 @@ module Jekyll
|
||||
converter.convert output
|
||||
rescue StandardError => e
|
||||
Jekyll.logger.error "Conversion error:",
|
||||
"#{converter.class} encountered an error while "\
|
||||
"#{converter.class} encountered an error while " \
|
||||
"converting '#{document.relative_path}':"
|
||||
Jekyll.logger.error("", e.to_s)
|
||||
raise e
|
||||
@@ -179,7 +179,7 @@ module Jekyll
|
||||
return unless invalid_layout?(layout)
|
||||
|
||||
Jekyll.logger.warn "Build Warning:", "Layout '#{document.data["layout"]}' requested " \
|
||||
"in #{document.relative_path} does not exist."
|
||||
"in #{document.relative_path} does not exist."
|
||||
end
|
||||
|
||||
# Render layout content into document.output
|
||||
|
||||
@@ -328,11 +328,11 @@ module Jekyll
|
||||
# Returns
|
||||
def relative_permalinks_are_deprecated
|
||||
if config["relative_permalinks"]
|
||||
Jekyll.logger.abort_with "Since v3.0, permalinks for pages" \
|
||||
" in subfolders must be relative to the" \
|
||||
" site source directory, not the parent" \
|
||||
" directory. Check https://jekyllrb.com/docs/upgrading/"\
|
||||
" for more info."
|
||||
Jekyll.logger.abort_with "Since v3.0, permalinks for pages " \
|
||||
"in subfolders must be relative to the " \
|
||||
"site source directory, not the parent " \
|
||||
"directory. Check https://jekyllrb.com/docs/upgrading/ " \
|
||||
"for more info."
|
||||
end
|
||||
end
|
||||
|
||||
@@ -536,8 +536,8 @@ module Jekyll
|
||||
if config["theme"].is_a?(String)
|
||||
Jekyll::Theme.new(config["theme"])
|
||||
else
|
||||
Jekyll.logger.warn "Theme:", "value of 'theme' in config should be " \
|
||||
"String to use gem-based themes, but got #{config["theme"].class}"
|
||||
Jekyll.logger.warn "Theme:", "value of 'theme' in config should be String to use " \
|
||||
"gem-based themes, but got #{config["theme"].class}"
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -104,8 +104,8 @@ module Jekyll
|
||||
"class=\"language-#{@lang.to_s.tr("+", "-")}\"",
|
||||
"data-lang=\"#{@lang}\"",
|
||||
].join(" ")
|
||||
"<figure class=\"highlight\"><pre><code #{code_attributes}>"\
|
||||
"#{code.chomp}</code></pre></figure>"
|
||||
"<figure class=\"highlight\"><pre><code #{code_attributes}>" \
|
||||
"#{code.chomp}</code></pre></figure>"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -179,8 +179,8 @@ module Jekyll
|
||||
private
|
||||
|
||||
def could_not_locate_message(file, includes_dirs, safe)
|
||||
message = "Could not locate the included file '#{file}' in any of "\
|
||||
"#{includes_dirs}. Ensure it exists in one of those directories and"
|
||||
message = "Could not locate the included file '#{file}' in any of #{includes_dirs}. " \
|
||||
"Ensure it exists in one of those directories and"
|
||||
message + if safe
|
||||
" is not a symlink as those are not allowed in safe mode."
|
||||
else
|
||||
|
||||
@@ -86,11 +86,11 @@ module Jekyll
|
||||
site.posts.docs.each do |document|
|
||||
next unless @post.deprecated_equality document
|
||||
|
||||
Jekyll::Deprecator.deprecation_message "A call to "\
|
||||
"'{% post_url #{@post.name} %}' did not match " \
|
||||
"a post using the new matching method of checking name " \
|
||||
"(path-date-slug) equality. Please make sure that you " \
|
||||
"change this tag to match the post's name exactly."
|
||||
Jekyll::Deprecator.deprecation_message(
|
||||
"A call to '{% post_url #{@post.name} %}' did not match a post using the new " \
|
||||
"matching method of checking name (path-date-slug) equality. Please make sure " \
|
||||
"that you change this tag to match the post's name exactly."
|
||||
)
|
||||
return relative_url(document)
|
||||
end
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ module Jekyll
|
||||
# Otherwise, Jekyll.sanitized path with prepend the unresolved root
|
||||
@root ||= File.realpath(gemspec.full_gem_path)
|
||||
rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP
|
||||
raise "Path #{gemspec.full_gem_path} does not exist, is not accessible "\
|
||||
"or includes a symbolic link loop"
|
||||
raise "Path #{gemspec.full_gem_path} does not exist, is not accessible or includes " \
|
||||
"a symbolic link loop"
|
||||
end
|
||||
|
||||
# The name of theme directory
|
||||
|
||||
@@ -100,7 +100,7 @@ module Jekyll
|
||||
winner = pool.find { |key| @placeholders.key?(key) }
|
||||
if winner.nil?
|
||||
raise NoMethodError,
|
||||
"The URL template doesn't have #{pool.join(" or ")} keys. "\
|
||||
"The URL template doesn't have #{pool.join(" or ")} keys. " \
|
||||
"Check your permalink template!"
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Frozen-string-literal: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Utils
|
||||
|
||||
Reference in New Issue
Block a user