New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Glob scope path only if configured with a pattern #6692
Changes from 4 commits
3ce57cd
28559b7
7764331
d409d4a
a69ffba
5b90b7e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,21 +97,26 @@ def applies?(scope, path, type) | |
applies_path?(scope, path) && applies_type?(scope, type) | ||
end | ||
|
||
# rubocop:disable Metrics/AbcSize | ||
def applies_path?(scope, path) | ||
return true if !scope.key?("path") || scope["path"].empty? | ||
|
||
sanitized_path = Pathname.new(sanitize_path(path)) | ||
|
||
site_path = Pathname.new(@site.source) | ||
site_path = Pathname.new(@site.source) | ||
rel_scope_path = Pathname.new(scope["path"]) | ||
abs_scope_path = File.join(@site.source, rel_scope_path) | ||
Dir.glob(abs_scope_path).each do |scope_path| | ||
scope_path = Pathname.new(scope_path).relative_path_from site_path | ||
return true if path_is_subpath?(sanitized_path, scope_path) | ||
|
||
if scope["path"].to_s.include?("*") | ||
Dir.glob(abs_scope_path).each do |scope_path| | ||
scope_path = Pathname.new(scope_path).relative_path_from site_path | ||
Jekyll.logger.debug "Globbed Scope Path:", scope_path | ||
return true if path_is_subpath?(sanitized_path, scope_path) | ||
end | ||
end | ||
|
||
path_is_subpath?(sanitized_path, rel_scope_path) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we make this an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
end | ||
# rubocop:enable Metrics/AbcSize | ||
|
||
def path_is_subpath?(path, parent_path) | ||
path.ascend do |ascended_path| | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
poison
sounds really terrifying! Can we rephrase?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is an issue with Ruby for Windows itself as Ruby is not optimized for Windows.. There's not much one can do here IMO..
So.. I'll just re-phrase the "poison" bit to something more mellow..