parent
d2c7c43c3f
commit
911e249d72
67
.rubocop.yml
67
.rubocop.yml
|
@ -27,6 +27,9 @@ AllCops:
|
||||||
|
|
||||||
Gemspec/DeprecatedAttributeAssignment:
|
Gemspec/DeprecatedAttributeAssignment:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Gemspec/RequireMFA:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Layout/BeginEndAlignment:
|
Layout/BeginEndAlignment:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Layout/EmptyComment:
|
Layout/EmptyComment:
|
||||||
|
@ -43,6 +46,12 @@ Layout/HashAlignment:
|
||||||
EnforcedHashRocketStyle: table
|
EnforcedHashRocketStyle: table
|
||||||
Layout/IndentationWidth:
|
Layout/IndentationWidth:
|
||||||
Severity: error
|
Severity: error
|
||||||
|
Layout/LineContinuationLeadingSpace:
|
||||||
|
Enabled: true
|
||||||
|
Layout/LineContinuationSpacing:
|
||||||
|
Enabled: true
|
||||||
|
Layout/LineEndStringConcatenationIndentation:
|
||||||
|
Enabled: true
|
||||||
Layout/LineLength:
|
Layout/LineLength:
|
||||||
Exclude:
|
Exclude:
|
||||||
- !ruby/regexp /features\/.*.rb/
|
- !ruby/regexp /features\/.*.rb/
|
||||||
|
@ -66,12 +75,18 @@ Layout/SpaceInsideHashLiteralBraces:
|
||||||
|
|
||||||
Lint/AmbiguousAssignment:
|
Lint/AmbiguousAssignment:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Lint/AmbiguousOperatorPrecedence:
|
||||||
|
Enabled: true
|
||||||
|
Lint/AmbiguousRange:
|
||||||
|
Enabled: true
|
||||||
Lint/BinaryOperatorWithIdenticalOperands:
|
Lint/BinaryOperatorWithIdenticalOperands:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/ConstantDefinitionInBlock:
|
Lint/ConstantDefinitionInBlock:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Exclude:
|
Exclude:
|
||||||
- test/**/*.rb
|
- test/**/*.rb
|
||||||
|
Lint/ConstantOverwrittenInRescue:
|
||||||
|
Enabled: true
|
||||||
Lint/DeprecatedConstants:
|
Lint/DeprecatedConstants:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/DeprecatedOpenSSLConstant:
|
Lint/DeprecatedOpenSSLConstant:
|
||||||
|
@ -123,6 +138,10 @@ Lint/RedundantDirGlobSort:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/RedundantSafeNavigation:
|
Lint/RedundantSafeNavigation:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Lint/RequireRangeParentheses:
|
||||||
|
Enabled: true
|
||||||
|
Lint/RequireRelativeSelfPath:
|
||||||
|
Enabled: true
|
||||||
Lint/SelfAssignment:
|
Lint/SelfAssignment:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/StructNewOverride:
|
Lint/StructNewOverride:
|
||||||
|
@ -187,6 +206,8 @@ Metrics/ParameterLists:
|
||||||
Metrics/PerceivedComplexity:
|
Metrics/PerceivedComplexity:
|
||||||
Max: 13
|
Max: 13
|
||||||
|
|
||||||
|
Minitest/AssertEmptyLiteral:
|
||||||
|
Enabled: false
|
||||||
Minitest/AssertInDelta:
|
Minitest/AssertInDelta:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Minitest/AssertionInLifecycleHook:
|
Minitest/AssertionInLifecycleHook:
|
||||||
|
@ -199,6 +220,8 @@ Minitest/AssertPathExists:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Minitest/AssertSilent:
|
Minitest/AssertSilent:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Minitest/AssertWithExpectedArgument:
|
||||||
|
Enabled: true
|
||||||
Minitest/LiteralAsActualArgument:
|
Minitest/LiteralAsActualArgument:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Minitest/TestMethodName:
|
Minitest/TestMethodName:
|
||||||
|
@ -211,10 +234,10 @@ Minitest/RefuteKindOf:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Minitest/RefutePathExists:
|
Minitest/RefutePathExists:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Minitest/UnreachableAssertion:
|
||||||
|
Enabled: true
|
||||||
Minitest/UnspecifiedException:
|
Minitest/UnspecifiedException:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Minitest/AssertEmptyLiteral:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Naming/FileName:
|
Naming/FileName:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
@ -242,10 +265,16 @@ Performance/CollectionLiteralInLoop:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/ConstantRegexp:
|
Performance/ConstantRegexp:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Performance/MapCompact:
|
||||||
|
Enabled: true
|
||||||
Performance/MethodObjectAsBlock:
|
Performance/MethodObjectAsBlock:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Performance/RedundantEqualityComparisonBlock:
|
||||||
|
Enabled: false
|
||||||
Performance/RedundantSortBlock:
|
Performance/RedundantSortBlock:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Performance/RedundantSplitRegexpArgument:
|
||||||
|
Enabled: true
|
||||||
Performance/RedundantStringChars:
|
Performance/RedundantStringChars:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/ReverseFirst:
|
Performance/ReverseFirst:
|
||||||
|
@ -254,6 +283,8 @@ Performance/SortReverse:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
Performance/Squeeze:
|
Performance/Squeeze:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Performance/StringIdentifierArgument:
|
||||||
|
Enabled: true
|
||||||
Performance/StringInclude:
|
Performance/StringInclude:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Exclude:
|
Exclude:
|
||||||
|
@ -261,6 +292,10 @@ Performance/StringInclude:
|
||||||
Performance/Sum:
|
Performance/Sum:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Security/CompoundHash:
|
||||||
|
Enabled: true
|
||||||
|
Security/IoMethods:
|
||||||
|
Enabled: true
|
||||||
Security/MarshalLoad:
|
Security/MarshalLoad:
|
||||||
Exclude:
|
Exclude:
|
||||||
- !ruby/regexp /test\/.*.rb$/
|
- !ruby/regexp /test\/.*.rb$/
|
||||||
|
@ -303,12 +338,20 @@ Style/Documentation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
Style/DoubleNegation:
|
Style/DoubleNegation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
Style/EmptyHeredoc:
|
||||||
|
Enabled: true
|
||||||
Style/EndlessMethod:
|
Style/EndlessMethod:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/ExplicitBlockArgument:
|
Style/ExplicitBlockArgument:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
Style/ExponentialNotation:
|
Style/ExponentialNotation:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Style/EnvHome:
|
||||||
|
Enabled: true
|
||||||
|
Style/FetchEnvVar:
|
||||||
|
Enabled: false
|
||||||
|
Style/FileRead:
|
||||||
|
Enabled: false
|
||||||
Style/FormatStringToken:
|
Style/FormatStringToken:
|
||||||
Exclude:
|
Exclude:
|
||||||
- lib/jekyll/utils/ansi.rb
|
- lib/jekyll/utils/ansi.rb
|
||||||
|
@ -316,6 +359,8 @@ Style/FormatStringToken:
|
||||||
- lib/jekyll/profiler.rb
|
- lib/jekyll/profiler.rb
|
||||||
Style/FrozenStringLiteralComment:
|
Style/FrozenStringLiteralComment:
|
||||||
EnforcedStyle: always
|
EnforcedStyle: always
|
||||||
|
Style/FileWrite:
|
||||||
|
Enabled: true
|
||||||
Style/GlobalStdStream:
|
Style/GlobalStdStream:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/GuardClause:
|
Style/GuardClause:
|
||||||
|
@ -341,6 +386,12 @@ Style/IfWithBooleanLiteralBranches:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/KeywordParametersOrder:
|
Style/KeywordParametersOrder:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Style/MagicCommentFormat:
|
||||||
|
Enabled: true
|
||||||
|
Style/MapCompactWithConditionalBlock:
|
||||||
|
Enabled: true
|
||||||
|
Style/MapToHash:
|
||||||
|
Enabled: true
|
||||||
Style/MixinUsage:
|
Style/MixinUsage:
|
||||||
Exclude:
|
Exclude:
|
||||||
- test/helper.rb
|
- test/helper.rb
|
||||||
|
@ -350,10 +401,14 @@ Style/MultilineTernaryOperator:
|
||||||
Severity: error
|
Severity: error
|
||||||
Style/NegatedIfElseCondition:
|
Style/NegatedIfElseCondition:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Style/NestedFileDirname:
|
||||||
|
Enabled: true
|
||||||
Style/NilLambda:
|
Style/NilLambda:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/OptionalBooleanParameter:
|
Style/OptionalBooleanParameter:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Exclude:
|
||||||
|
- lib/jekyll/log_adapter.rb
|
||||||
Style/PercentLiteralDelimiters:
|
Style/PercentLiteralDelimiters:
|
||||||
PreferredDelimiters:
|
PreferredDelimiters:
|
||||||
"%Q": "{}"
|
"%Q": "{}"
|
||||||
|
@ -363,6 +418,8 @@ Style/PercentLiteralDelimiters:
|
||||||
"%s": ()
|
"%s": ()
|
||||||
"%w": ()
|
"%w": ()
|
||||||
"%x": ()
|
"%x": ()
|
||||||
|
Style/QuotedSymbols:
|
||||||
|
Enabled: true
|
||||||
Style/RedundantArgument:
|
Style/RedundantArgument:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/RedundantAssignment:
|
Style/RedundantAssignment:
|
||||||
|
@ -371,12 +428,18 @@ Style/RedundantFetchBlock:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
Style/RedundantFileExtensionInRequire:
|
Style/RedundantFileExtensionInRequire:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Style/RedundantInitialize:
|
||||||
|
Enabled: true
|
||||||
|
Exclude:
|
||||||
|
- lib/jekyll/plugin.rb
|
||||||
Style/RedundantRegexpCharacterClass:
|
Style/RedundantRegexpCharacterClass:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/RedundantRegexpEscape:
|
Style/RedundantRegexpEscape:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/RedundantSelfAssignment:
|
Style/RedundantSelfAssignment:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Style/RedundantSelfAssignmentBranch:
|
||||||
|
Enabled: true
|
||||||
Style/RegexpLiteral:
|
Style/RegexpLiteral:
|
||||||
EnforcedStyle: percent_r
|
EnforcedStyle: percent_r
|
||||||
Style/RescueModifier:
|
Style/RescueModifier:
|
||||||
|
|
2
Gemfile
2
Gemfile
|
@ -23,7 +23,7 @@ group :test do
|
||||||
gem "nokogiri", "~> 1.7"
|
gem "nokogiri", "~> 1.7"
|
||||||
gem "rspec"
|
gem "rspec"
|
||||||
gem "rspec-mocks"
|
gem "rspec-mocks"
|
||||||
gem "rubocop", "~> 1.32.0"
|
gem "rubocop", "~> 1.36.0"
|
||||||
gem "rubocop-minitest"
|
gem "rubocop-minitest"
|
||||||
gem "rubocop-performance"
|
gem "rubocop-performance"
|
||||||
gem "rubocop-rake"
|
gem "rubocop-rake"
|
||||||
|
|
|
@ -30,8 +30,8 @@ module Jekyll
|
||||||
site = Jekyll::Site.new(options)
|
site = Jekyll::Site.new(options)
|
||||||
|
|
||||||
if options.fetch("skip_initial_build", false)
|
if options.fetch("skip_initial_build", false)
|
||||||
Jekyll.logger.warn "Build Warning:", "Skipping the initial build." \
|
Jekyll.logger.warn "Build Warning:",
|
||||||
" This may result in an out-of-date site."
|
"Skipping the initial build. This may result in an out-of-date site."
|
||||||
else
|
else
|
||||||
build(site, options)
|
build(site, options)
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,8 +7,7 @@ module Jekyll
|
||||||
def init_with_program(prog)
|
def init_with_program(prog)
|
||||||
prog.command(:clean) do |c|
|
prog.command(:clean) do |c|
|
||||||
c.syntax "clean [subcommand]"
|
c.syntax "clean [subcommand]"
|
||||||
c.description "Clean the site " \
|
c.description "Clean the site (removes site output and metadata file) without building."
|
||||||
"(removes site output and metadata file) without building."
|
|
||||||
|
|
||||||
add_build_options(c)
|
add_build_options(c)
|
||||||
|
|
||||||
|
|
|
@ -105,9 +105,9 @@ module Jekyll
|
||||||
next unless real_urls.uniq.size > 1
|
next unless real_urls.uniq.size > 1
|
||||||
|
|
||||||
urls_only_differ_by_case = true
|
urls_only_differ_by_case = true
|
||||||
Jekyll.logger.warn "Warning:", "The following URLs only differ" \
|
Jekyll.logger.warn "Warning:", "The following URLs only differ by case. On a " \
|
||||||
" by case. On a case-insensitive file system one of the URLs" \
|
"case-insensitive file system one of the URLs will be " \
|
||||||
" will be overwritten by the other: #{real_urls.join(", ")}"
|
"overwritten by the other: #{real_urls.join(", ")}"
|
||||||
end
|
end
|
||||||
urls_only_differ_by_case
|
urls_only_differ_by_case
|
||||||
end
|
end
|
||||||
|
@ -148,8 +148,8 @@ module Jekyll
|
||||||
def url_exists?(url)
|
def url_exists?(url)
|
||||||
return true unless url.nil? || url.empty?
|
return true unless url.nil? || url.empty?
|
||||||
|
|
||||||
Jekyll.logger.warn "Warning:", "You didn't set an URL in the config file, "\
|
Jekyll.logger.warn "Warning:", "You didn't set an URL in the config file, you may " \
|
||||||
"you may encounter problems with some plugins."
|
"encounter problems with some plugins."
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ module Jekyll
|
||||||
FileUtils.mkdir_p new_blog_path
|
FileUtils.mkdir_p new_blog_path
|
||||||
if preserve_source_location?(new_blog_path, options)
|
if preserve_source_location?(new_blog_path, options)
|
||||||
Jekyll.logger.error "Conflict:", "#{new_blog_path} exists and is not empty."
|
Jekyll.logger.error "Conflict:", "#{new_blog_path} exists and is not empty."
|
||||||
Jekyll.logger.abort_with "", "Ensure #{new_blog_path} is empty or else " \
|
Jekyll.logger.abort_with "", "Ensure #{new_blog_path} is empty or else try again " \
|
||||||
"try again with `--force` to proceed and overwrite any files."
|
"with `--force` to proceed and overwrite any files."
|
||||||
end
|
end
|
||||||
|
|
||||||
if options["blank"]
|
if options["blank"]
|
||||||
|
@ -108,13 +108,9 @@ module Jekyll
|
||||||
def create_site(new_blog_path)
|
def create_site(new_blog_path)
|
||||||
create_sample_files new_blog_path
|
create_sample_files new_blog_path
|
||||||
|
|
||||||
File.open(File.expand_path(initialized_post_name, new_blog_path), "w") do |f|
|
File.write(File.expand_path(initialized_post_name, new_blog_path), scaffold_post_content)
|
||||||
f.write(scaffold_post_content)
|
|
||||||
end
|
|
||||||
|
|
||||||
File.open(File.expand_path("Gemfile", new_blog_path), "w") do |f|
|
File.write(File.expand_path("Gemfile", new_blog_path), gemfile_contents)
|
||||||
f.write(gemfile_contents)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def preserve_source_location?(path, options)
|
def preserve_source_location?(path, options)
|
||||||
|
|
|
@ -10,8 +10,7 @@ module Jekyll
|
||||||
prog.command(:"new-theme") do |c|
|
prog.command(:"new-theme") do |c|
|
||||||
c.syntax "new-theme NAME"
|
c.syntax "new-theme NAME"
|
||||||
c.description "Creates a new Jekyll theme scaffold"
|
c.description "Creates a new Jekyll theme scaffold"
|
||||||
c.option "code_of_conduct", \
|
c.option "code_of_conduct", "-c", "--code-of-conduct",
|
||||||
"-c", "--code-of-conduct", \
|
|
||||||
"Include a Code of Conduct. (defaults to false)"
|
"Include a Code of Conduct. (defaults to false)"
|
||||||
|
|
||||||
c.action do |args, opts|
|
c.action do |args, opts|
|
||||||
|
|
|
@ -132,9 +132,9 @@ module Jekyll
|
||||||
livereload_max_delay
|
livereload_max_delay
|
||||||
livereload_ignore
|
livereload_ignore
|
||||||
livereload_port).any? { |o| opts[o] }
|
livereload_port).any? { |o| opts[o] }
|
||||||
Jekyll.logger.abort_with "--livereload-min-delay, "\
|
Jekyll.logger.abort_with "--livereload-min-delay, --livereload-max-delay, " \
|
||||||
"--livereload-max-delay, --livereload-ignore, and "\
|
"--livereload-ignore, and --livereload-port require " \
|
||||||
"--livereload-port require the --livereload option."
|
"the --livereload option."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -174,7 +174,8 @@ module Jekyll
|
||||||
# Do a base pre-setup of WEBRick so that everything is in place
|
# 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
|
# when we get ready to party, checking for an setting up an error page
|
||||||
# and making sure our destination exists.
|
# and making sure our destination exists.
|
||||||
|
#
|
||||||
|
# rubocop:disable Security/IoMethods
|
||||||
def setup(destination)
|
def setup(destination)
|
||||||
require_relative "serve/servlet"
|
require_relative "serve/servlet"
|
||||||
|
|
||||||
|
@ -188,6 +189,7 @@ module Jekyll
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# rubocop:enable Security/IoMethods
|
||||||
|
|
||||||
def webrick_opts(opts)
|
def webrick_opts(opts)
|
||||||
opts = {
|
opts = {
|
||||||
|
@ -263,8 +265,7 @@ module Jekyll
|
||||||
return system "xdg-open", address if Utils::Platforms.linux?
|
return system "xdg-open", address if Utils::Platforms.linux?
|
||||||
return system "open", address if Utils::Platforms.osx?
|
return system "open", address if Utils::Platforms.osx?
|
||||||
|
|
||||||
Jekyll.logger.error "Refusing to launch browser; " \
|
Jekyll.logger.error "Refusing to launch browser. Platform launcher unknown."
|
||||||
"Platform launcher unknown."
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Keep in our area with a thread or detach the server as requested
|
# Keep in our area with a thread or detach the server as requested
|
||||||
|
@ -277,9 +278,8 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
Process.detach(pid)
|
Process.detach(pid)
|
||||||
Jekyll.logger.info "Server detached with pid '#{pid}'.", \
|
Jekyll.logger.info "Server detached with pid '#{pid}'.",
|
||||||
"Run `pkill -f jekyll' or `kill -9 #{pid}'" \
|
"Run `pkill -f jekyll' or `kill -9 #{pid}' to stop the server."
|
||||||
" to stop the server."
|
|
||||||
else
|
else
|
||||||
t = Thread.new { server.start }
|
t = Thread.new { server.start }
|
||||||
trap("INT") { server.shutdown }
|
trap("INT") { server.shutdown }
|
||||||
|
|
|
@ -304,8 +304,8 @@ module Jekyll
|
||||||
return if config["plugins"].is_a?(Array)
|
return if config["plugins"].is_a?(Array)
|
||||||
|
|
||||||
Jekyll.logger.error "'plugins' should be set as an array of gem-names, but was: " \
|
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 " \
|
"#{config["plugins"].inspect}. Use 'plugins_dir' instead to set " \
|
||||||
"for your non-gemified Ruby plugins."
|
"the directory for your non-gemified Ruby plugins."
|
||||||
raise Jekyll::Errors::InvalidConfigurationError,
|
raise Jekyll::Errors::InvalidConfigurationError,
|
||||||
"'plugins' should be set as an array, but was: #{config["plugins"].inspect}."
|
"'plugins' should be set as an array, but was: #{config["plugins"].inspect}."
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Frozen-string-literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Kramdown
|
module Kramdown
|
||||||
# A Kramdown::Document subclass meant to optimize memory usage from initializing
|
# A Kramdown::Document subclass meant to optimize memory usage from initializing
|
||||||
|
|
|
@ -78,8 +78,8 @@ module Jekyll
|
||||||
}
|
}
|
||||||
|
|
||||||
unless @registry[owner][event]
|
unless @registry[owner][event]
|
||||||
raise NotAvailable, "Invalid hook. #{owner} supports only the " \
|
raise NotAvailable, "Invalid hook. #{owner} supports only the following hooks " \
|
||||||
"following hooks #{@registry[owner].keys.inspect}"
|
"#{@registry[owner].keys.inspect}"
|
||||||
end
|
end
|
||||||
|
|
||||||
raise Uncallable, "Hooks must respond to :call" unless block.respond_to? :call
|
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") ||
|
pagination_included = (site.config["plugins"] || []).include?("jekyll-paginate") ||
|
||||||
defined?(Jekyll::Paginate)
|
defined?(Jekyll::Paginate)
|
||||||
if site.config["paginate"] && !pagination_included
|
if site.config["paginate"] && !pagination_included
|
||||||
Jekyll::Deprecator.deprecation_message "You appear to have pagination " \
|
Jekyll::Deprecator.deprecation_message <<~MSG
|
||||||
"turned on, but you haven't included the `jekyll-paginate` gem. " \
|
You appear to have pagination turned on, but you haven't included the `jekyll-paginate`
|
||||||
"Ensure you have `plugins: [jekyll-paginate]` in your configuration file."
|
gem. Ensure you have `plugins: [jekyll-paginate]` in your configuration file.
|
||||||
|
MSG
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -536,8 +536,8 @@ module Jekyll
|
||||||
if config["theme"].is_a?(String)
|
if config["theme"].is_a?(String)
|
||||||
Jekyll::Theme.new(config["theme"])
|
Jekyll::Theme.new(config["theme"])
|
||||||
else
|
else
|
||||||
Jekyll.logger.warn "Theme:", "value of 'theme' in config should be " \
|
Jekyll.logger.warn "Theme:", "value of 'theme' in config should be String to use " \
|
||||||
"String to use gem-based themes, but got #{config["theme"].class}"
|
"gem-based themes, but got #{config["theme"].class}"
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -179,8 +179,8 @@ module Jekyll
|
||||||
private
|
private
|
||||||
|
|
||||||
def could_not_locate_message(file, includes_dirs, safe)
|
def could_not_locate_message(file, includes_dirs, safe)
|
||||||
message = "Could not locate the included file '#{file}' in any of "\
|
message = "Could not locate the included file '#{file}' in any of #{includes_dirs}. " \
|
||||||
"#{includes_dirs}. Ensure it exists in one of those directories and"
|
"Ensure it exists in one of those directories and"
|
||||||
message + if safe
|
message + if safe
|
||||||
" is not a symlink as those are not allowed in safe mode."
|
" is not a symlink as those are not allowed in safe mode."
|
||||||
else
|
else
|
||||||
|
|
|
@ -86,11 +86,11 @@ module Jekyll
|
||||||
site.posts.docs.each do |document|
|
site.posts.docs.each do |document|
|
||||||
next unless @post.deprecated_equality document
|
next unless @post.deprecated_equality document
|
||||||
|
|
||||||
Jekyll::Deprecator.deprecation_message "A call to "\
|
Jekyll::Deprecator.deprecation_message(
|
||||||
"'{% post_url #{@post.name} %}' did not match " \
|
"A call to '{% post_url #{@post.name} %}' did not match a post using the new " \
|
||||||
"a post using the new matching method of checking name " \
|
"matching method of checking name (path-date-slug) equality. Please make sure " \
|
||||||
"(path-date-slug) equality. Please make sure that you " \
|
"that you change this tag to match the post's name exactly."
|
||||||
"change this tag to match the post's name exactly."
|
)
|
||||||
return relative_url(document)
|
return relative_url(document)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ module Jekyll
|
||||||
# Otherwise, Jekyll.sanitized path with prepend the unresolved root
|
# Otherwise, Jekyll.sanitized path with prepend the unresolved root
|
||||||
@root ||= File.realpath(gemspec.full_gem_path)
|
@root ||= File.realpath(gemspec.full_gem_path)
|
||||||
rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP
|
rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP
|
||||||
raise "Path #{gemspec.full_gem_path} does not exist, is not accessible "\
|
raise "Path #{gemspec.full_gem_path} does not exist, is not accessible or includes " \
|
||||||
"or includes a symbolic link loop"
|
"a symbolic link loop"
|
||||||
end
|
end
|
||||||
|
|
||||||
# The name of theme directory
|
# The name of theme directory
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Frozen-string-literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module Utils
|
module Utils
|
||||||
|
|
|
@ -105,8 +105,7 @@ class JekyllUnitTest < Minitest::Test
|
||||||
end
|
end
|
||||||
|
|
||||||
def mocks_expect(*args)
|
def mocks_expect(*args)
|
||||||
RSpec::Mocks::ExampleMethods::ExpectHost.instance_method(:expect)\
|
RSpec::Mocks::ExampleMethods::ExpectHost.instance_method(:expect).bind(self).call(*args)
|
||||||
.bind(self).call(*args)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_setup
|
def before_setup
|
||||||
|
@ -166,7 +165,7 @@ class JekyllUnitTest < Minitest::Test
|
||||||
def directory_with_contents(path)
|
def directory_with_contents(path)
|
||||||
FileUtils.rm_rf(path)
|
FileUtils.rm_rf(path)
|
||||||
FileUtils.mkdir(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
|
end
|
||||||
|
|
||||||
def with_env(key, value)
|
def with_env(key, value)
|
||||||
|
|
|
@ -75,9 +75,7 @@ class TestCommandsServe < JekyllUnitTest
|
||||||
</html>
|
</html>
|
||||||
HTML
|
HTML
|
||||||
|
|
||||||
File.open(File.join(@destination, "hello.html"), "w") do |f|
|
File.write(File.join(@destination, "hello.html"), simple_page)
|
||||||
f.write(simple_page)
|
|
||||||
end
|
|
||||||
allow(Jekyll::Site).to receive(:new).and_return(site)
|
allow(Jekyll::Site).to receive(:new).and_return(site)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ class TestDoctorCommand < JekyllUnitTest
|
||||||
assert_equal "", output
|
assert_equal "", output
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop:disable Layout/LineLength
|
||||||
should "return warning for pages only differing by case" do
|
should "return warning for pages only differing by case" do
|
||||||
@site = Site.new(Jekyll.configuration(
|
@site = Site.new(Jekyll.configuration(
|
||||||
"source" => File.join(source_dir, "/_urls_differ_by_case_invalid"),
|
"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)
|
ret = Jekyll::Commands::Doctor.urls_only_differ_by_case(@site)
|
||||||
assert ret
|
assert ret
|
||||||
end
|
end
|
||||||
assert_includes output, "Warning: The following URLs only differ by case. "\
|
assert_includes output, "Warning: The following URLs only differ by case. On a case-" \
|
||||||
"On a case-insensitive file system one of the URLs will be overwritten by the "\
|
"insensitive file system one of the URLs will be overwritten by the " \
|
||||||
"other: #{dest_dir}/about/index.html, #{dest_dir}/About/index.html"
|
"other: #{dest_dir}/about/index.html, #{dest_dir}/About/index.html"
|
||||||
end
|
end
|
||||||
|
# rubocop:enable Layout/LineLength
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -111,8 +111,7 @@ class TestExcerpt < JekyllUnitTest
|
||||||
context "#content" do
|
context "#content" do
|
||||||
context "before render" do
|
context "before render" do
|
||||||
should "be the first paragraph of the page" do
|
should "be the first paragraph of the page" do
|
||||||
expected = "First paragraph with [link ref][link].\n\n[link]: "\
|
expected = "First paragraph with [link ref][link].\n\n[link]: https://jekyllrb.com/"
|
||||||
"https://jekyllrb.com/"
|
|
||||||
assert_equal expected, @excerpt.content
|
assert_equal expected, @excerpt.content
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -146,7 +145,7 @@ class TestExcerpt < JekyllUnitTest
|
||||||
end
|
end
|
||||||
|
|
||||||
should "contain all refs at the bottom of the page" do
|
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
|
assert_match "[link_#{i}]: www.example.com/#{i}", @excerpt.content
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -159,7 +158,7 @@ class TestExcerpt < JekyllUnitTest
|
||||||
@rendered_post = @post.dup
|
@rendered_post = @post.dup
|
||||||
do_render(@rendered_post)
|
do_render(@rendered_post)
|
||||||
output = @rendered_post.data["excerpt"].output
|
output = @rendered_post.data["excerpt"].output
|
||||||
(0..3).each do |i|
|
4.times do |i|
|
||||||
assert_includes output, "<a href=\"www.example.com/#{i}\">"
|
assert_includes output, "<a href=\"www.example.com/#{i}\">"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -164,8 +164,8 @@ class TestPageWithoutAFile < JekyllUnitTest
|
||||||
refute_path_exists(dest_dir("virtual-about", "index.html"))
|
refute_path_exists(dest_dir("virtual-about", "index.html"))
|
||||||
end
|
end
|
||||||
|
|
||||||
should "be processed and written to destination when passed as "\
|
should "be processed and written to destination when passed as an entry in " \
|
||||||
"an entry in 'site.pages' array" do
|
"'site.pages' array" do
|
||||||
@page.content = "{{ site.title }}"
|
@page.content = "{{ site.title }}"
|
||||||
@page.data["permalink"] = "/virtual-about/"
|
@page.data["permalink"] = "/virtual-about/"
|
||||||
|
|
||||||
|
|
|
@ -174,9 +174,7 @@ class TestRegenerator < JekyllUnitTest
|
||||||
metadata_file = source_dir(".jekyll-metadata")
|
metadata_file = source_dir(".jekyll-metadata")
|
||||||
@regenerator = Regenerator.new(@site)
|
@regenerator = Regenerator.new(@site)
|
||||||
|
|
||||||
File.open(metadata_file, "w") do |f|
|
File.write(metadata_file, @regenerator.metadata.to_yaml)
|
||||||
f.write(@regenerator.metadata.to_yaml)
|
|
||||||
end
|
|
||||||
|
|
||||||
@regenerator = Regenerator.new(@site)
|
@regenerator = Regenerator.new(@site)
|
||||||
assert_equal File.mtime(@path), @regenerator.metadata[@path]["mtime"]
|
assert_equal File.mtime(@path), @regenerator.metadata[@path]["mtime"]
|
||||||
|
|
|
@ -621,8 +621,8 @@ class TestSite < JekyllUnitTest
|
||||||
site = fixture_site("theme" => {})
|
site = fixture_site("theme" => {})
|
||||||
assert_nil site.theme
|
assert_nil site.theme
|
||||||
end
|
end
|
||||||
expected_msg = "Theme: value of 'theme' in config should be String " \
|
expected_msg = "Theme: value of 'theme' in config should be String to use " \
|
||||||
"to use gem-based themes, but got Hash\n"
|
"gem-based themes, but got Hash\n"
|
||||||
assert_includes output, expected_msg
|
assert_includes output, expected_msg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -450,10 +450,10 @@ class TestTags < JekyllUnitTest
|
||||||
end
|
end
|
||||||
|
|
||||||
should "throw a deprecation warning" do
|
should "throw a deprecation warning" do
|
||||||
deprecation_warning = " Deprecation: A call to "\
|
deprecation_warning = " Deprecation: A call to '{% post_url 2008-11-21-nested %}' " \
|
||||||
"'{% post_url 2008-11-21-nested %}' did not match a post using the new matching "\
|
"did not match a post using the new matching method of checking " \
|
||||||
"method of checking name (path-date-slug) equality. Please make sure that you "\
|
"name (path-date-slug) equality. Please make sure that you change " \
|
||||||
"change this tag to match the post's name exactly."
|
"this tag to match the post's name exactly."
|
||||||
assert_includes Jekyll.logger.messages, deprecation_warning
|
assert_includes Jekyll.logger.messages, deprecation_warning
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -693,7 +693,7 @@ class TestTags < JekyllUnitTest
|
||||||
context "include tag with parameters" do
|
context "include tag with parameters" do
|
||||||
context "with symlink'd include" do
|
context "with symlink'd include" do
|
||||||
should "not allow symlink includes" 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
|
assert_raises IOError do
|
||||||
content = <<~CONTENT
|
content = <<~CONTENT
|
||||||
---
|
---
|
||||||
|
@ -1142,7 +1142,7 @@ class TestTags < JekyllUnitTest
|
||||||
|
|
||||||
context "with symlink'd include" do
|
context "with symlink'd include" do
|
||||||
should "not allow symlink includes" 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
|
assert_raises IOError do
|
||||||
content = <<~CONTENT
|
content = <<~CONTENT
|
||||||
---
|
---
|
||||||
|
|
|
@ -14,15 +14,14 @@ class TestThemeAssetsReader < JekyllUnitTest
|
||||||
def assert_file_with_relative_path(haystack, relative_path)
|
def assert_file_with_relative_path(haystack, relative_path)
|
||||||
assert haystack.any? { |f|
|
assert haystack.any? { |f|
|
||||||
f.relative_path == relative_path
|
f.relative_path == relative_path
|
||||||
}, "Site should read in the #{relative_path} file, " \
|
}, "Site should read in the #{relative_path} file, but it was not found in #{haystack.inspect}"
|
||||||
"but it was not found in #{haystack.inspect}"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def refute_file_with_relative_path(haystack, relative_path)
|
def refute_file_with_relative_path(haystack, relative_path)
|
||||||
refute haystack.any? { |f|
|
refute haystack.any? { |f|
|
||||||
f.relative_path == relative_path
|
f.relative_path == relative_path
|
||||||
}, "Site should not have read in the #{relative_path} file, " \
|
}, "Site should not have read in the #{relative_path} file, but it was found in " \
|
||||||
"but it was found in #{haystack.inspect}"
|
"#{haystack.inspect}"
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with a valid theme" do
|
context "with a valid theme" do
|
||||||
|
@ -82,7 +81,7 @@ class TestThemeAssetsReader < JekyllUnitTest
|
||||||
|
|
||||||
begin
|
begin
|
||||||
tmp_dir = Dir.mktmpdir("jekyll-theme-test")
|
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")
|
theme_dir = File.join(__dir__, "fixtures", "test-theme-symlink")
|
||||||
File.symlink(tmp_dir, File.join(theme_dir, "assets"))
|
File.symlink(tmp_dir, File.join(theme_dir, "assets"))
|
||||||
|
|
Loading…
Reference in New Issue