parent
37b4a4bd89
commit
e300964879
|
@ -65,8 +65,6 @@
|
||||||
# @jekyll/stability
|
# @jekyll/stability
|
||||||
Gemfile @jekyll/stability
|
Gemfile @jekyll/stability
|
||||||
*.gemspec @jekyll/stability
|
*.gemspec @jekyll/stability
|
||||||
.travis.yml @jekyll/stability
|
|
||||||
appveyor.yml @jekyll/stability
|
|
||||||
/lib/jekyll/configuration.rb @jekyll/stability
|
/lib/jekyll/configuration.rb @jekyll/stability
|
||||||
/lib/jekyll/deprecator.rb @jekyll/stability
|
/lib/jekyll/deprecator.rb @jekyll/stability
|
||||||
/lib/jekyll/frontmatter_defaults.rb @jekyll/stability
|
/lib/jekyll/frontmatter_defaults.rb @jekyll/stability
|
||||||
|
|
|
@ -12,27 +12,28 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
name: "Run Tests (${{ matrix.label }})"
|
name: "Run Tests (${{ matrix.ruby.label }} on ${{ matrix.os.label }})"
|
||||||
runs-on: "ubuntu-latest"
|
runs-on: ${{ matrix.os.image }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
ruby:
|
||||||
- label: Ruby 2.7
|
- label: Ruby 2.7
|
||||||
ruby_version: "2.7"
|
version: "2.7"
|
||||||
- label: Ruby 3.0
|
- label: Ruby 3.3
|
||||||
ruby_version: "3.0"
|
version: "3.3"
|
||||||
- label: Ruby 3.1
|
os:
|
||||||
ruby_version: "3.1"
|
- label: Linux
|
||||||
- label: Ruby 3.2
|
image: "ubuntu-latest"
|
||||||
ruby_version: "3.2"
|
- label: Windows
|
||||||
|
image: "windows-latest"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: "Set up ${{ matrix.label }}"
|
- name: "Set up ${{ matrix.ruby.label }}"
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: ${{ matrix.ruby_version }}
|
ruby-version: ${{ matrix.ruby.version }}
|
||||||
bundler-cache: true
|
bundler-cache: true
|
||||||
- name: Run Minitest based tests
|
- name: Run Minitest based tests
|
||||||
run: bash script/test
|
run: bash script/test
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# [Jekyll](https://jekyllrb.com/)
|
# [Jekyll](https://jekyllrb.com/)
|
||||||
|
|
||||||
[][ruby-gems]
|
[][ruby-gems]
|
||||||
[][ci-workflow]
|
[][ci-workflow]
|
||||||
[][appveyor]
|
|
||||||
[](#backers)
|
[](#backers)
|
||||||
[](#sponsors)
|
[](#sponsors)
|
||||||
|
|
||||||
|
|
49
appveyor.yml
49
appveyor.yml
|
@ -1,49 +0,0 @@
|
||||||
version: "{build}"
|
|
||||||
image: Visual Studio 2019
|
|
||||||
build: off
|
|
||||||
|
|
||||||
clone_depth: 5
|
|
||||||
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- themes
|
|
||||||
- /.*-stable$/
|
|
||||||
|
|
||||||
environment:
|
|
||||||
BUNDLE_WITHOUT: "benchmark:development"
|
|
||||||
matrix:
|
|
||||||
- RUBY_FOLDER_VER: "27"
|
|
||||||
TZINFO_VERSION: "~> 1.2"
|
|
||||||
TEST_SUITE: "test"
|
|
||||||
- RUBY_FOLDER_VER: "27"
|
|
||||||
TZINFO_VERSION: "~> 2.0"
|
|
||||||
TEST_SUITE: "test"
|
|
||||||
- RUBY_FOLDER_VER: "27"
|
|
||||||
TEST_SUITE: "default-site"
|
|
||||||
- RUBY_FOLDER_VER: "27"
|
|
||||||
TEST_SUITE: "profile-docs"
|
|
||||||
- RUBY_FOLDER_VER: "27"
|
|
||||||
TEST_SUITE: "memprof"
|
|
||||||
- RUBY_FOLDER_VER: "27"
|
|
||||||
TZINFO_VERSION: "~> 1.2"
|
|
||||||
TEST_SUITE: "cucumber"
|
|
||||||
- RUBY_FOLDER_VER: "27"
|
|
||||||
TZINFO_VERSION: "~> 2.0"
|
|
||||||
TEST_SUITE: "cucumber"
|
|
||||||
|
|
||||||
install:
|
|
||||||
- SET PATH=C:\Ruby%RUBY_FOLDER_VER%-x64\bin;%PATH%
|
|
||||||
- bundle config set --local clean 'true'
|
|
||||||
- bundle config set --local path 'vendor\bundle'
|
|
||||||
- bundle install --retry 5 --jobs=%NUMBER_OF_PROCESSORS%
|
|
||||||
|
|
||||||
test_script:
|
|
||||||
- ruby --version
|
|
||||||
- gem --version
|
|
||||||
- bundler --version
|
|
||||||
- bash ./script/cibuild
|
|
||||||
|
|
||||||
cache:
|
|
||||||
# If one of the files after the right arrow changes, cache will be invalidated
|
|
||||||
- 'vendor\bundle -> appveyor.yml,Gemfile,jekyll.gemspec'
|
|
|
@ -82,8 +82,8 @@ Feature: Collections
|
||||||
When I run jekyll build
|
When I run jekyll build
|
||||||
Then I should get a zero exit status
|
Then I should get a zero exit status
|
||||||
Then the _site directory should exist
|
Then the _site directory should exist
|
||||||
And I should see "Collections: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/trailing-dots...md _methods/um_hi.md" in "_site/index.html" unless Windows
|
And I should see "Collections: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/trailing-dots...md _methods/um_hi.md" in "_site/index.html" if platform supports symlinks
|
||||||
And I should see "Collections: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/trailing-dots...md _methods/yaml_with_dots.md" in "_site/index.html" if on Windows
|
And I should see "Collections: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/trailing-dots...md _methods/yaml_with_dots.md" in "_site/index.html" if platform does not support symlinks
|
||||||
|
|
||||||
Scenario: Collections specified as an hash
|
Scenario: Collections specified as an hash
|
||||||
Given I have an "index.html" page that contains "Collections: {% for method in site.methods %}{{ method.relative_path }} {% endfor %}"
|
Given I have an "index.html" page that contains "Collections: {% for method in site.methods %}{{ method.relative_path }} {% endfor %}"
|
||||||
|
@ -96,8 +96,8 @@ Feature: Collections
|
||||||
When I run jekyll build
|
When I run jekyll build
|
||||||
Then I should get a zero exit status
|
Then I should get a zero exit status
|
||||||
Then the _site directory should exist
|
Then the _site directory should exist
|
||||||
And I should see "Collections: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/trailing-dots...md _methods/um_hi.md" in "_site/index.html" unless Windows
|
And I should see "Collections: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/trailing-dots...md _methods/um_hi.md" in "_site/index.html" if platform supports symlinks
|
||||||
And I should see "Collections: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/trailing-dots...md _methods/yaml_with_dots.md" in "_site/index.html" if on Windows
|
And I should see "Collections: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/trailing-dots...md _methods/yaml_with_dots.md" in "_site/index.html" if platform does not support symlinks
|
||||||
|
|
||||||
Scenario: Rendered collection with document with future date
|
Scenario: Rendered collection with document with future date
|
||||||
Given I have a _puppies directory
|
Given I have a _puppies directory
|
||||||
|
@ -377,8 +377,8 @@ Feature: Collections
|
||||||
When I run jekyll build
|
When I run jekyll build
|
||||||
Then I should get a zero exit status
|
Then I should get a zero exit status
|
||||||
Then the _site directory should exist
|
Then the _site directory should exist
|
||||||
And I should see "All documents: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/trailing-dots...md _methods/um_hi.md" in "_site/index.html" unless Windows
|
And I should see "All documents: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/trailing-dots...md _methods/um_hi.md" in "_site/index.html" if platform supports symlinks
|
||||||
And I should see "All documents: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/trailing-dots...md _methods/yaml_with_dots.md" in "_site/index.html" if on Windows
|
And I should see "All documents: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/trailing-dots...md _methods/yaml_with_dots.md" in "_site/index.html" if platform does not support symlinks
|
||||||
|
|
||||||
Scenario: Documents have an output attribute, which is the converted HTML
|
Scenario: Documents have an output attribute, which is the converted HTML
|
||||||
Given I have an "index.html" page that contains "Second document's output: {{ site.documents[2].output }}"
|
Given I have an "index.html" page that contains "Second document's output: {{ site.documents[2].output }}"
|
||||||
|
@ -432,8 +432,8 @@ Feature: Collections
|
||||||
When I run jekyll build
|
When I run jekyll build
|
||||||
Then I should get a zero exit status
|
Then I should get a zero exit status
|
||||||
And the _site directory should exist
|
And the _site directory should exist
|
||||||
And I should see "2. of 10: <p>Page without title.</p>" in "_site/index.html" unless Windows
|
And I should see "2. of 10: <p>Page without title.</p>" in "_site/index.html" if platform supports symlinks
|
||||||
And I should see "2. of 9: <p>Page without title.</p>" in "_site/index.html" if on Windows
|
And I should see "2. of 9: <p>Page without title.</p>" in "_site/index.html" if platform does not support symlinks
|
||||||
|
|
||||||
Scenario: Sort by relative_path
|
Scenario: Sort by relative_path
|
||||||
Given I have an "index.html" page that contains "Collections: {% assign methods = site.methods | sort: 'relative_path' %}{{ methods | map:"title" | join: ", " }}"
|
Given I have an "index.html" page that contains "Collections: {% assign methods = site.methods | sort: 'relative_path' %}{{ methods | map:"title" | join: ", " }}"
|
||||||
|
@ -446,8 +446,8 @@ Feature: Collections
|
||||||
When I run jekyll build
|
When I run jekyll build
|
||||||
Then I should get a zero exit status
|
Then I should get a zero exit status
|
||||||
Then the _site directory should exist
|
Then the _site directory should exist
|
||||||
And I should see "Collections: this is a test!, Collection#entries, Jekyll.configuration, Jekyll.escape, Jekyll.sanitized_path, Site#generate, Initialize, Ellipsis Path, Site#generate, YAML with Dots" in "_site/index.html" unless Windows
|
And I should see "Collections: this is a test!, Collection#entries, Jekyll.configuration, Jekyll.escape, Jekyll.sanitized_path, Site#generate, Initialize, Ellipsis Path, Site#generate, YAML with Dots" in "_site/index.html" if platform supports symlinks
|
||||||
And I should see "Collections: this is a test!, Collection#entries, Jekyll.configuration, Jekyll.escape, Jekyll.sanitized_path, Site#generate, Initialize, Ellipsis Path, YAML with Dots" in "_site/index.html" if on Windows
|
And I should see "Collections: this is a test!, Collection#entries, Jekyll.configuration, Jekyll.escape, Jekyll.sanitized_path, Site#generate, Initialize, Ellipsis Path, YAML with Dots" in "_site/index.html" if platform does not support symlinks
|
||||||
|
|
||||||
Scenario: Sort all entries by a Front Matter key defined in all entries
|
Scenario: Sort all entries by a Front Matter key defined in all entries
|
||||||
Given I have an "index.html" page that contains "Collections: {{ site.tutorials | map: 'title' | join: ', ' }}"
|
Given I have an "index.html" page that contains "Collections: {{ site.tutorials | map: 'title' | join: ', ' }}"
|
||||||
|
|
|
@ -287,28 +287,28 @@ end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
Then(%r!^I should (not )?see "(.*)" in "(.*)" if on Windows$!) do |negative, text, file|
|
Then(%r!^I should (not )?see "(.*)" in "(.*)" if platform does not support symlinks$!) do |negative, text, file|
|
||||||
step %(the "#{file}" file should exist)
|
step %(the "#{file}" file should exist)
|
||||||
regexp = Regexp.new(text, Regexp::MULTILINE)
|
regexp = Regexp.new(text, Regexp::MULTILINE)
|
||||||
if negative.nil? || negative.empty?
|
if negative.nil? || negative.empty?
|
||||||
if Jekyll::Utils::Platforms.really_windows?
|
if Platform.supports_symlink?
|
||||||
expect(file_contents(file)).to match regexp
|
|
||||||
else
|
|
||||||
expect(file_contents(file)).not_to match regexp
|
expect(file_contents(file)).not_to match regexp
|
||||||
|
else
|
||||||
|
expect(file_contents(file)).to match regexp
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
Then(%r!^I should (not )?see "(.*)" in "(.*)" unless Windows$!) do |negative, text, file|
|
Then(%r!^I should (not )?see "(.*)" in "(.*)" if platform supports symlinks$!) do |negative, text, file|
|
||||||
step %(the "#{file}" file should exist)
|
step %(the "#{file}" file should exist)
|
||||||
regexp = Regexp.new(text, Regexp::MULTILINE)
|
regexp = Regexp.new(text, Regexp::MULTILINE)
|
||||||
if negative.nil? || negative.empty?
|
if negative.nil? || negative.empty?
|
||||||
if Jekyll::Utils::Platforms.really_windows?
|
if Platform.supports_symlink?
|
||||||
expect(file_contents(file)).not_to match regexp
|
|
||||||
else
|
|
||||||
expect(file_contents(file)).to match regexp
|
expect(file_contents(file)).to match regexp
|
||||||
|
else
|
||||||
|
expect(file_contents(file)).not_to match regexp
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,6 +18,13 @@ class Paths
|
||||||
def self.source_dir; SOURCE_DIR; end
|
def self.source_dir; SOURCE_DIR; end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Platform
|
||||||
|
REF_FILE = File.expand_path("../../test/source/symlink-test/symlinked-file", __dir__)
|
||||||
|
|
||||||
|
def self.supports_symlink?; File.symlink?(REF_FILE); end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
def file_content_from_hash(input_hash)
|
def file_content_from_hash(input_hash)
|
||||||
|
|
|
@ -93,6 +93,37 @@ module DirectoryHelpers
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module Jekyll
|
||||||
|
#
|
||||||
|
# --- NOTE: ---
|
||||||
|
#
|
||||||
|
# This monkey-patch was introduced because GitHub Actions on Windows acknowledges symlinked test
|
||||||
|
# file `test/source/symlink-test/symlinked-file-outside-source` but errors out since the linked
|
||||||
|
# location `/etc/passwd` does not exist on Windows.
|
||||||
|
#
|
||||||
|
# --- TODO: ---
|
||||||
|
#
|
||||||
|
# Consider having the `symlinked-file-outside-source` point to a file that is outside the
|
||||||
|
# `source_dir` (defaults to `test/source`) yet is certain to exist on tested platforms.
|
||||||
|
# For example, `jekyll.gemspec` is a good candidate.
|
||||||
|
#
|
||||||
|
# This monkey-patch will then no longer be necessary.
|
||||||
|
#
|
||||||
|
class ModifiedReader < Reader
|
||||||
|
def read_directories(dir = "")
|
||||||
|
if dir.start_with?("/symlink") && Utils::Platforms.really_windows?
|
||||||
|
Jekyll.logger.debug "Skipping:", "Jekyll does not support symlinks on Windows"
|
||||||
|
else
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Hooks.register :site, :after_init do |site|
|
||||||
|
site.instance_variable_set(:@reader, ModifiedReader.new(site))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class JekyllUnitTest < Minitest::Test
|
class JekyllUnitTest < Minitest::Test
|
||||||
include ::RSpec::Mocks::ExampleMethods
|
include ::RSpec::Mocks::ExampleMethods
|
||||||
include DirectoryHelpers
|
include DirectoryHelpers
|
||||||
|
|
Loading…
Reference in New Issue