parent
d2c7c43c3f
commit
911e249d72
67
.rubocop.yml
67
.rubocop.yml
|
@ -27,6 +27,9 @@ AllCops:
|
|||
|
||||
Gemspec/DeprecatedAttributeAssignment:
|
||||
Enabled: true
|
||||
Gemspec/RequireMFA:
|
||||
Enabled: false
|
||||
|
||||
Layout/BeginEndAlignment:
|
||||
Enabled: true
|
||||
Layout/EmptyComment:
|
||||
|
@ -43,6 +46,12 @@ Layout/HashAlignment:
|
|||
EnforcedHashRocketStyle: table
|
||||
Layout/IndentationWidth:
|
||||
Severity: error
|
||||
Layout/LineContinuationLeadingSpace:
|
||||
Enabled: true
|
||||
Layout/LineContinuationSpacing:
|
||||
Enabled: true
|
||||
Layout/LineEndStringConcatenationIndentation:
|
||||
Enabled: true
|
||||
Layout/LineLength:
|
||||
Exclude:
|
||||
- !ruby/regexp /features\/.*.rb/
|
||||
|
@ -66,12 +75,18 @@ Layout/SpaceInsideHashLiteralBraces:
|
|||
|
||||
Lint/AmbiguousAssignment:
|
||||
Enabled: true
|
||||
Lint/AmbiguousOperatorPrecedence:
|
||||
Enabled: true
|
||||
Lint/AmbiguousRange:
|
||||
Enabled: true
|
||||
Lint/BinaryOperatorWithIdenticalOperands:
|
||||
Enabled: true
|
||||
Lint/ConstantDefinitionInBlock:
|
||||
Enabled: true
|
||||
Exclude:
|
||||
- test/**/*.rb
|
||||
Lint/ConstantOverwrittenInRescue:
|
||||
Enabled: true
|
||||
Lint/DeprecatedConstants:
|
||||
Enabled: true
|
||||
Lint/DeprecatedOpenSSLConstant:
|
||||
|
@ -123,6 +138,10 @@ Lint/RedundantDirGlobSort:
|
|||
Enabled: true
|
||||
Lint/RedundantSafeNavigation:
|
||||
Enabled: true
|
||||
Lint/RequireRangeParentheses:
|
||||
Enabled: true
|
||||
Lint/RequireRelativeSelfPath:
|
||||
Enabled: true
|
||||
Lint/SelfAssignment:
|
||||
Enabled: true
|
||||
Lint/StructNewOverride:
|
||||
|
@ -187,6 +206,8 @@ Metrics/ParameterLists:
|
|||
Metrics/PerceivedComplexity:
|
||||
Max: 13
|
||||
|
||||
Minitest/AssertEmptyLiteral:
|
||||
Enabled: false
|
||||
Minitest/AssertInDelta:
|
||||
Enabled: true
|
||||
Minitest/AssertionInLifecycleHook:
|
||||
|
@ -199,6 +220,8 @@ Minitest/AssertPathExists:
|
|||
Enabled: true
|
||||
Minitest/AssertSilent:
|
||||
Enabled: true
|
||||
Minitest/AssertWithExpectedArgument:
|
||||
Enabled: true
|
||||
Minitest/LiteralAsActualArgument:
|
||||
Enabled: true
|
||||
Minitest/TestMethodName:
|
||||
|
@ -211,10 +234,10 @@ Minitest/RefuteKindOf:
|
|||
Enabled: true
|
||||
Minitest/RefutePathExists:
|
||||
Enabled: true
|
||||
Minitest/UnreachableAssertion:
|
||||
Enabled: true
|
||||
Minitest/UnspecifiedException:
|
||||
Enabled: true
|
||||
Minitest/AssertEmptyLiteral:
|
||||
Enabled: false
|
||||
|
||||
Naming/FileName:
|
||||
Enabled: false
|
||||
|
@ -242,10 +265,16 @@ Performance/CollectionLiteralInLoop:
|
|||
Enabled: true
|
||||
Performance/ConstantRegexp:
|
||||
Enabled: true
|
||||
Performance/MapCompact:
|
||||
Enabled: true
|
||||
Performance/MethodObjectAsBlock:
|
||||
Enabled: true
|
||||
Performance/RedundantEqualityComparisonBlock:
|
||||
Enabled: false
|
||||
Performance/RedundantSortBlock:
|
||||
Enabled: true
|
||||
Performance/RedundantSplitRegexpArgument:
|
||||
Enabled: true
|
||||
Performance/RedundantStringChars:
|
||||
Enabled: true
|
||||
Performance/ReverseFirst:
|
||||
|
@ -254,6 +283,8 @@ Performance/SortReverse:
|
|||
Enabled: false
|
||||
Performance/Squeeze:
|
||||
Enabled: true
|
||||
Performance/StringIdentifierArgument:
|
||||
Enabled: true
|
||||
Performance/StringInclude:
|
||||
Enabled: true
|
||||
Exclude:
|
||||
|
@ -261,6 +292,10 @@ Performance/StringInclude:
|
|||
Performance/Sum:
|
||||
Enabled: true
|
||||
|
||||
Security/CompoundHash:
|
||||
Enabled: true
|
||||
Security/IoMethods:
|
||||
Enabled: true
|
||||
Security/MarshalLoad:
|
||||
Exclude:
|
||||
- !ruby/regexp /test\/.*.rb$/
|
||||
|
@ -303,12 +338,20 @@ Style/Documentation:
|
|||
Enabled: false
|
||||
Style/DoubleNegation:
|
||||
Enabled: false
|
||||
Style/EmptyHeredoc:
|
||||
Enabled: true
|
||||
Style/EndlessMethod:
|
||||
Enabled: true
|
||||
Style/ExplicitBlockArgument:
|
||||
Enabled: false
|
||||
Style/ExponentialNotation:
|
||||
Enabled: true
|
||||
Style/EnvHome:
|
||||
Enabled: true
|
||||
Style/FetchEnvVar:
|
||||
Enabled: false
|
||||
Style/FileRead:
|
||||
Enabled: false
|
||||
Style/FormatStringToken:
|
||||
Exclude:
|
||||
- lib/jekyll/utils/ansi.rb
|
||||
|
@ -316,6 +359,8 @@ Style/FormatStringToken:
|
|||
- lib/jekyll/profiler.rb
|
||||
Style/FrozenStringLiteralComment:
|
||||
EnforcedStyle: always
|
||||
Style/FileWrite:
|
||||
Enabled: true
|
||||
Style/GlobalStdStream:
|
||||
Enabled: true
|
||||
Style/GuardClause:
|
||||
|
@ -341,6 +386,12 @@ Style/IfWithBooleanLiteralBranches:
|
|||
Enabled: true
|
||||
Style/KeywordParametersOrder:
|
||||
Enabled: true
|
||||
Style/MagicCommentFormat:
|
||||
Enabled: true
|
||||
Style/MapCompactWithConditionalBlock:
|
||||
Enabled: true
|
||||
Style/MapToHash:
|
||||
Enabled: true
|
||||
Style/MixinUsage:
|
||||
Exclude:
|
||||
- test/helper.rb
|
||||
|
@ -350,10 +401,14 @@ Style/MultilineTernaryOperator:
|
|||
Severity: error
|
||||
Style/NegatedIfElseCondition:
|
||||
Enabled: true
|
||||
Style/NestedFileDirname:
|
||||
Enabled: true
|
||||
Style/NilLambda:
|
||||
Enabled: true
|
||||
Style/OptionalBooleanParameter:
|
||||
Enabled: true
|
||||
Exclude:
|
||||
- lib/jekyll/log_adapter.rb
|
||||
Style/PercentLiteralDelimiters:
|
||||
PreferredDelimiters:
|
||||
"%Q": "{}"
|
||||
|
@ -363,6 +418,8 @@ Style/PercentLiteralDelimiters:
|
|||
"%s": ()
|
||||
"%w": ()
|
||||
"%x": ()
|
||||
Style/QuotedSymbols:
|
||||
Enabled: true
|
||||
Style/RedundantArgument:
|
||||
Enabled: true
|
||||
Style/RedundantAssignment:
|
||||
|
@ -371,12 +428,18 @@ Style/RedundantFetchBlock:
|
|||
Enabled: false
|
||||
Style/RedundantFileExtensionInRequire:
|
||||
Enabled: true
|
||||
Style/RedundantInitialize:
|
||||
Enabled: true
|
||||
Exclude:
|
||||
- lib/jekyll/plugin.rb
|
||||
Style/RedundantRegexpCharacterClass:
|
||||
Enabled: true
|
||||
Style/RedundantRegexpEscape:
|
||||
Enabled: true
|
||||
Style/RedundantSelfAssignment:
|
||||
Enabled: true
|
||||
Style/RedundantSelfAssignmentBranch:
|
||||
Enabled: true
|
||||
Style/RegexpLiteral:
|
||||
EnforcedStyle: percent_r
|
||||
Style/RescueModifier:
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -23,7 +23,7 @@ group :test do
|
|||
gem "nokogiri", "~> 1.7"
|
||||
gem "rspec"
|
||||
gem "rspec-mocks"
|
||||
gem "rubocop", "~> 1.32.0"
|
||||
gem "rubocop", "~> 1.36.0"
|
||||
gem "rubocop-minitest"
|
||||
gem "rubocop-performance"
|
||||
gem "rubocop-rake"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -105,8 +105,7 @@ class JekyllUnitTest < Minitest::Test
|
|||
end
|
||||
|
||||
def mocks_expect(*args)
|
||||
RSpec::Mocks::ExampleMethods::ExpectHost.instance_method(:expect)\
|
||||
.bind(self).call(*args)
|
||||
RSpec::Mocks::ExampleMethods::ExpectHost.instance_method(:expect).bind(self).call(*args)
|
||||
end
|
||||
|
||||
def before_setup
|
||||
|
@ -166,7 +165,7 @@ class JekyllUnitTest < Minitest::Test
|
|||
def directory_with_contents(path)
|
||||
FileUtils.rm_rf(path)
|
||||
FileUtils.mkdir(path)
|
||||
File.open("#{path}/index.html", "w") { |f| f.write("I was previously generated.") }
|
||||
File.write("#{path}/index.html", "I was previously generated.")
|
||||
end
|
||||
|
||||
def with_env(key, value)
|
||||
|
|
|
@ -75,9 +75,7 @@ class TestCommandsServe < JekyllUnitTest
|
|||
</html>
|
||||
HTML
|
||||
|
||||
File.open(File.join(@destination, "hello.html"), "w") do |f|
|
||||
f.write(simple_page)
|
||||
end
|
||||
File.write(File.join(@destination, "hello.html"), simple_page)
|
||||
allow(Jekyll::Site).to receive(:new).and_return(site)
|
||||
end
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ class TestDoctorCommand < JekyllUnitTest
|
|||
assert_equal "", output
|
||||
end
|
||||
|
||||
# rubocop:disable Layout/LineLength
|
||||
should "return warning for pages only differing by case" do
|
||||
@site = Site.new(Jekyll.configuration(
|
||||
"source" => File.join(source_dir, "/_urls_differ_by_case_invalid"),
|
||||
|
@ -32,9 +33,10 @@ class TestDoctorCommand < JekyllUnitTest
|
|||
ret = Jekyll::Commands::Doctor.urls_only_differ_by_case(@site)
|
||||
assert ret
|
||||
end
|
||||
assert_includes output, "Warning: The following URLs only differ by case. "\
|
||||
"On a case-insensitive file system one of the URLs will be overwritten by the "\
|
||||
"other: #{dest_dir}/about/index.html, #{dest_dir}/About/index.html"
|
||||
assert_includes output, "Warning: The following URLs only differ by case. On a case-" \
|
||||
"insensitive file system one of the URLs will be overwritten by the " \
|
||||
"other: #{dest_dir}/about/index.html, #{dest_dir}/About/index.html"
|
||||
end
|
||||
# rubocop:enable Layout/LineLength
|
||||
end
|
||||
end
|
||||
|
|
|
@ -111,8 +111,7 @@ class TestExcerpt < JekyllUnitTest
|
|||
context "#content" do
|
||||
context "before render" do
|
||||
should "be the first paragraph of the page" do
|
||||
expected = "First paragraph with [link ref][link].\n\n[link]: "\
|
||||
"https://jekyllrb.com/"
|
||||
expected = "First paragraph with [link ref][link].\n\n[link]: https://jekyllrb.com/"
|
||||
assert_equal expected, @excerpt.content
|
||||
end
|
||||
|
||||
|
@ -129,7 +128,7 @@ class TestExcerpt < JekyllUnitTest
|
|||
end
|
||||
|
||||
should "be the first paragraph of the page" do
|
||||
expected = "<p>First paragraph with <a href=\"https://jekyllrb.com/\">link "\
|
||||
expected = "<p>First paragraph with <a href=\"https://jekyllrb.com/\">link " \
|
||||
"ref</a>.</p>\n\n"
|
||||
assert_equal expected, @extracted_excerpt.output
|
||||
end
|
||||
|
@ -146,7 +145,7 @@ class TestExcerpt < JekyllUnitTest
|
|||
end
|
||||
|
||||
should "contain all refs at the bottom of the page" do
|
||||
(0..3).each do |i|
|
||||
4.times do |i|
|
||||
assert_match "[link_#{i}]: www.example.com/#{i}", @excerpt.content
|
||||
end
|
||||
end
|
||||
|
@ -159,7 +158,7 @@ class TestExcerpt < JekyllUnitTest
|
|||
@rendered_post = @post.dup
|
||||
do_render(@rendered_post)
|
||||
output = @rendered_post.data["excerpt"].output
|
||||
(0..3).each do |i|
|
||||
4.times do |i|
|
||||
assert_includes output, "<a href=\"www.example.com/#{i}\">"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -164,8 +164,8 @@ class TestPageWithoutAFile < JekyllUnitTest
|
|||
refute_path_exists(dest_dir("virtual-about", "index.html"))
|
||||
end
|
||||
|
||||
should "be processed and written to destination when passed as "\
|
||||
"an entry in 'site.pages' array" do
|
||||
should "be processed and written to destination when passed as an entry in " \
|
||||
"'site.pages' array" do
|
||||
@page.content = "{{ site.title }}"
|
||||
@page.data["permalink"] = "/virtual-about/"
|
||||
|
||||
|
|
|
@ -174,9 +174,7 @@ class TestRegenerator < JekyllUnitTest
|
|||
metadata_file = source_dir(".jekyll-metadata")
|
||||
@regenerator = Regenerator.new(@site)
|
||||
|
||||
File.open(metadata_file, "w") do |f|
|
||||
f.write(@regenerator.metadata.to_yaml)
|
||||
end
|
||||
File.write(metadata_file, @regenerator.metadata.to_yaml)
|
||||
|
||||
@regenerator = Regenerator.new(@site)
|
||||
assert_equal File.mtime(@path), @regenerator.metadata[@path]["mtime"]
|
||||
|
|
|
@ -621,8 +621,8 @@ class TestSite < JekyllUnitTest
|
|||
site = fixture_site("theme" => {})
|
||||
assert_nil site.theme
|
||||
end
|
||||
expected_msg = "Theme: value of 'theme' in config should be String " \
|
||||
"to use gem-based themes, but got Hash\n"
|
||||
expected_msg = "Theme: value of 'theme' in config should be String to use " \
|
||||
"gem-based themes, but got Hash\n"
|
||||
assert_includes output, expected_msg
|
||||
end
|
||||
|
||||
|
|
|
@ -450,10 +450,10 @@ class TestTags < JekyllUnitTest
|
|||
end
|
||||
|
||||
should "throw a deprecation warning" do
|
||||
deprecation_warning = " Deprecation: A call to "\
|
||||
"'{% post_url 2008-11-21-nested %}' 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."
|
||||
deprecation_warning = " Deprecation: A call to '{% post_url 2008-11-21-nested %}' " \
|
||||
"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."
|
||||
assert_includes Jekyll.logger.messages, deprecation_warning
|
||||
end
|
||||
end
|
||||
|
@ -693,7 +693,7 @@ class TestTags < JekyllUnitTest
|
|||
context "include tag with parameters" do
|
||||
context "with symlink'd include" do
|
||||
should "not allow symlink includes" do
|
||||
File.open("tmp/pages-test", "w") { |file| file.write("SYMLINK TEST") }
|
||||
File.write("tmp/pages-test", "SYMLINK TEST")
|
||||
assert_raises IOError do
|
||||
content = <<~CONTENT
|
||||
---
|
||||
|
@ -1142,7 +1142,7 @@ class TestTags < JekyllUnitTest
|
|||
|
||||
context "with symlink'd include" do
|
||||
should "not allow symlink includes" do
|
||||
File.open("tmp/pages-test", "w") { |file| file.write("SYMLINK TEST") }
|
||||
File.write("tmp/pages-test", "SYMLINK TEST")
|
||||
assert_raises IOError do
|
||||
content = <<~CONTENT
|
||||
---
|
||||
|
@ -1181,7 +1181,7 @@ class TestTags < JekyllUnitTest
|
|||
"safe" => true)
|
||||
end
|
||||
assert_match(
|
||||
"Ensure it exists in one of those directories and is not a symlink "\
|
||||
"Ensure it exists in one of those directories and is not a symlink " \
|
||||
"as those are not allowed in safe mode.",
|
||||
ex.message
|
||||
)
|
||||
|
|
|
@ -14,15 +14,14 @@ class TestThemeAssetsReader < JekyllUnitTest
|
|||
def assert_file_with_relative_path(haystack, relative_path)
|
||||
assert haystack.any? { |f|
|
||||
f.relative_path == relative_path
|
||||
}, "Site should read in the #{relative_path} file, " \
|
||||
"but it was not found in #{haystack.inspect}"
|
||||
}, "Site should read in the #{relative_path} file, but it was not found in #{haystack.inspect}"
|
||||
end
|
||||
|
||||
def refute_file_with_relative_path(haystack, relative_path)
|
||||
refute haystack.any? { |f|
|
||||
f.relative_path == relative_path
|
||||
}, "Site should not have read in the #{relative_path} file, " \
|
||||
"but it was found in #{haystack.inspect}"
|
||||
}, "Site should not have read in the #{relative_path} file, but it was found in " \
|
||||
"#{haystack.inspect}"
|
||||
end
|
||||
|
||||
context "with a valid theme" do
|
||||
|
@ -82,7 +81,7 @@ class TestThemeAssetsReader < JekyllUnitTest
|
|||
|
||||
begin
|
||||
tmp_dir = Dir.mktmpdir("jekyll-theme-test")
|
||||
File.open(File.join(tmp_dir, "test.txt"), "wb") { |f| f.write "content" }
|
||||
File.binwrite(File.join(tmp_dir, "test.txt"), "content")
|
||||
|
||||
theme_dir = File.join(__dir__, "fixtures", "test-theme-symlink")
|
||||
File.symlink(tmp_dir, File.join(theme_dir, "assets"))
|
||||
|
|
Loading…
Reference in New Issue