mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce1db82dbb | ||
|
|
855544ab29 | ||
|
|
29ecdbdec5 | ||
|
|
04f93171b8 | ||
|
|
55a39dd568 | ||
|
|
3c9a7eef5b | ||
|
|
54010a784c | ||
|
|
f73e8b16f8 | ||
|
|
ba024ea1b7 |
36
.github/workflows/ci.yml
vendored
36
.github/workflows/ci.yml
vendored
@@ -3,19 +3,18 @@ name: Continuous Integration
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- /.*-stable/
|
||||
- 4.2-stable
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- /.*-stable/
|
||||
- 4.2-stable
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
if: "!contains(github.event.commits[0].message, '[ci skip]')"
|
||||
name: 'Ruby ${{ matrix.ruby_version }}'
|
||||
runs-on: 'ubuntu-latest'
|
||||
|
||||
env:
|
||||
CI: true
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -23,7 +22,6 @@ jobs:
|
||||
- 2.5
|
||||
- 2.7
|
||||
- jruby-9.2.11.1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
@@ -35,12 +33,8 @@ jobs:
|
||||
bundler-cache: true
|
||||
- name: Run Unit Tests
|
||||
run: bash script/test
|
||||
env:
|
||||
CI: true
|
||||
- name: Run Cucumber Features
|
||||
run: bash script/cucumber
|
||||
env:
|
||||
CI: true
|
||||
- name: Sanity Check
|
||||
run: bash script/default-site
|
||||
|
||||
@@ -69,34 +63,22 @@ jobs:
|
||||
if: "!contains(github.event.commits[0].message, '[ci skip]')"
|
||||
name: 'Profile Docs Site (Ruby ${{ matrix.ruby_version }})'
|
||||
runs-on: 'ubuntu-latest'
|
||||
env:
|
||||
CI: true
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
ruby_version:
|
||||
- 2.4 # Minimum required Ruby version in gemspec
|
||||
- 2.5
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 5
|
||||
- name: "Set up Ruby ${{ matrix.ruby_version }}"
|
||||
uses: actions/setup-ruby@v1
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ matrix.ruby_version }}
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: vendor/bundle
|
||||
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gems-
|
||||
- name: 'Update Rubygems and Bundler'
|
||||
run: |
|
||||
gem update --system --no-document
|
||||
gem update bundler --no-document
|
||||
- name: Set up bundle
|
||||
run: |
|
||||
bundle config path vendor/bundle
|
||||
bundle install --jobs 4 --retry 3
|
||||
bundler-cache: true
|
||||
- name: Build Docs site with --profile
|
||||
run: bash script/profile-docs
|
||||
- name: Profile memory usage of building Docs site
|
||||
|
||||
27
.github/workflows/third-party.yml
vendored
27
.github/workflows/third-party.yml
vendored
@@ -3,14 +3,20 @@ name: Third-Party Repository Profiling
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- 4.2-stable
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- 4.2-stable
|
||||
jobs:
|
||||
build_n_profile:
|
||||
if: "!contains(github.event.commits[0].message, '[ci skip]')"
|
||||
runs-on: 'ubuntu-latest'
|
||||
env:
|
||||
BUNDLE_GEMFILE: "sandbox/Gemfile"
|
||||
BUNDLE_PATH: "vendor/bundle"
|
||||
BUNDLE_JOBS: 4
|
||||
BUNDLE_RETRY: 3
|
||||
CI: true
|
||||
steps:
|
||||
- name: Checkout Jekyll
|
||||
uses: actions/checkout@v2
|
||||
@@ -23,23 +29,10 @@ jobs:
|
||||
repository: ashmaroli/tomjoht.github.io
|
||||
path: sandbox
|
||||
- name: Set up Ruby
|
||||
uses: actions/setup-ruby@v1
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.7
|
||||
- name: Set up Dependencies Cache
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: sandbox/vendor/bundle
|
||||
key: ubuntu-latest-gems-${{ hashFiles('**/Gemfile.lock') }}
|
||||
restore-keys: |
|
||||
ubuntu-latest-gems-
|
||||
- name: Set up Dependencies
|
||||
run: |
|
||||
gem update --system --no-document
|
||||
gem update bundler --no-document
|
||||
bundle config gemfile sandbox/Gemfile
|
||||
bundle config path vendor/bundle
|
||||
bundle install --jobs 4 --retry 3
|
||||
bundler-cache: true
|
||||
- name: Run Jekyll Build 3 times
|
||||
run: |
|
||||
bundle exec jekyll build -s sandbox -d sandbox/_site --trace
|
||||
|
||||
@@ -10,6 +10,7 @@ Jekyll/NoPutsAllowed:
|
||||
- rake/*.rake
|
||||
|
||||
AllCops:
|
||||
SuggestExtensions: false
|
||||
TargetRubyVersion: 2.4
|
||||
Include:
|
||||
- lib/**/*.rb
|
||||
@@ -303,6 +304,8 @@ Style/RedundantArgument:
|
||||
Enabled: true
|
||||
Style/RedundantAssignment:
|
||||
Enabled: true
|
||||
Style/RedundantBegin:
|
||||
Enabled: false
|
||||
Style/RedundantFetchBlock:
|
||||
Enabled: false
|
||||
Style/RedundantFileExtensionInRequire:
|
||||
|
||||
2
Gemfile
2
Gemfile
@@ -23,7 +23,7 @@ group :test do
|
||||
gem "nokogiri", "~> 1.7"
|
||||
gem "rspec"
|
||||
gem "rspec-mocks"
|
||||
gem "rubocop", "~> 1.0"
|
||||
gem "rubocop", "~> 1.12.0"
|
||||
gem "rubocop-performance"
|
||||
gem "test-dependency-theme", :path => File.expand_path("test/fixtures/test-dependency-theme", __dir__)
|
||||
gem "test-theme", :path => File.expand_path("test/fixtures/test-theme", __dir__)
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
## 4.2.1 / 2021-09-27
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Backport #8620 for v4.2.x: Revert #7253: "Don't reset site.url to localhost:4000 by default" (#8808)
|
||||
* Backport #8756 for v4.2.x: Respect collections_dir config within include tag (#8794)
|
||||
* Backport #8786 for v4.2.x: Fix regression in Convertible module from v4.2.0 (#8793)
|
||||
|
||||
## 4.2.0 / 2020-12-14
|
||||
|
||||
### Minor Enhancements
|
||||
|
||||
@@ -79,8 +79,16 @@ called `_site`.
|
||||
* `jekyll serve` - Does the same thing except it rebuilds any time you make
|
||||
a change and runs a local web server at `http://localhost:4000`.
|
||||
|
||||
When you're developing a site you'll use `jekyll serve` as it updates with any
|
||||
changes you make.
|
||||
{: .note .info}
|
||||
When you're developing a site, use `jekyll serve`. To force the browser to refresh with every change, use `jekyll serve --livereload`.
|
||||
If there's a conflict or you'd like Jekyll to serve your development site at a different URL, use the `--host` and `--port` arguments,
|
||||
as described in the [serve command options]({{ '/docs/configuration/options/#serve-command-options' | relative_url }}).
|
||||
|
||||
{: .note .warning}
|
||||
The version of the site that `jekyll serve` builds in `_site` is not suited for deployment. Links and asset URLs in sites created
|
||||
with `jekyll serve` will use `https://localhost:4000` or the value set with command-line configuration, instead of the values set
|
||||
in [your site's configuration file]({{ '/docs/configuration/' | relative_url }}). To learn about how to build your site when it's
|
||||
ready for deployment, read the [Deployment]({{ '/docs/step-by-step/10-deployment/' | relative_url }}) section of this tutorial.
|
||||
|
||||
Run `jekyll serve` and go to
|
||||
<a href="http://localhost:4000" target="_blank" data-proofer-ignore>http://localhost:4000</a> in
|
||||
|
||||
@@ -143,7 +143,21 @@ to do this is to run a production build:
|
||||
JEKYLL_ENV=production bundle exec jekyll build
|
||||
```
|
||||
|
||||
And copy the contents of `_site` to your server.
|
||||
And then copy the contents of `_site` to your server.
|
||||
|
||||
<div class="note warning">
|
||||
<h5>Destination folders are cleaned on site builds</h5>
|
||||
<p>
|
||||
The contents of <code>_site</code> are automatically cleaned, by default, when
|
||||
the site is built. Files or folders that are not created by your site's build
|
||||
process will be removed.
|
||||
</p>
|
||||
<p>
|
||||
Some files could be retained by specifying them within the <code>keep_files</code>
|
||||
configuration directive. Other files could be retained by keeping them in your
|
||||
assets directory.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
A better way is to automate this process using a [CI](/docs/deployment/automated/)
|
||||
or [3rd party](/docs/deployment/third-party/).
|
||||
|
||||
@@ -184,17 +184,17 @@ Feature: Create sites
|
||||
Given I have a _posts directory
|
||||
And I have the following post:
|
||||
| title | date | layout | content |
|
||||
| entry1 | 2020-12-31 | post | content for entry1. |
|
||||
| entry1 | 2040-12-31 | post | content for entry1. |
|
||||
| entry2 | 2007-12-31 | post | content for entry2. |
|
||||
When I run jekyll build
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see "content for entry2" in "_site/2007/12/31/entry2.html"
|
||||
And the "_site/2020/12/31/entry1.html" file should not exist
|
||||
And the "_site/2040/12/31/entry1.html" file should not exist
|
||||
When I run jekyll build --future
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And the "_site/2020/12/31/entry1.html" file should exist
|
||||
And the "_site/2040/12/31/entry1.html" file should exist
|
||||
|
||||
Scenario: Basic site with layouts, posts and related posts
|
||||
Given I have a _layouts directory
|
||||
|
||||
@@ -67,6 +67,25 @@ Feature: Incremental rebuild
|
||||
And the _site directory should exist
|
||||
And I should see "Basic Site with include tag: Regenerated by Jekyll" in "_site/index.html"
|
||||
|
||||
Scenario: Rebuild when a dependency of document in custom collection_dir is changed
|
||||
Given I have a _includes directory
|
||||
And I have a configuration file with "collections_dir" set to "collections"
|
||||
And I have a collections/_posts directory
|
||||
And I have the following post within the "collections" directory:
|
||||
| title | date | layout | content |
|
||||
| Wargames | 2009-03-27 | default | Basic Site with include tag: {% include about.html %} |
|
||||
And I have an "_includes/about.html" file that contains "Generated by Jekyll"
|
||||
When I run jekyll build -I
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/2009/03/27/wargames.html"
|
||||
When I wait 1 second
|
||||
Then I have an "_includes/about.html" file that contains "Regenerated by Jekyll"
|
||||
When I run jekyll build -I
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see "Basic Site with include tag: Regenerated by Jekyll" in "_site/2009/03/27/wargames.html"
|
||||
|
||||
Scenario: A themed-site and incremental regeneration
|
||||
Given I have a configuration file with "theme" set to "test-theme"
|
||||
And I have an "index.md" page that contains "Themed site"
|
||||
|
||||
@@ -108,7 +108,7 @@ Feature: Post excerpts
|
||||
Then I should get a zero exit status
|
||||
And I should not see "Kramdown warning" in the build output
|
||||
But I should see exactly "<p>Install Jekyll</p>" in "_site/just-text-excerpt.html"
|
||||
And I should see "<p>Alpha <sup id=\"fnref:1\" role=\"doc-noteref\"><a href=\"#fn:1\" class=\"footnote\">1</a></sup></p>" in "_site/text-and-footnote.html"
|
||||
And I should see "<p>Alpha <sup id=\"fnref:1\" role=\"doc-noteref\"><a href=\"#fn:1\" class=\"footnote\" rel=\"footnote\">1</a></sup></p>" in "_site/text-and-footnote.html"
|
||||
And I should see "<p>Omega sigma <a href=\"#fnref:1\" class=\"reversefootnote\" role=\"doc-backlink\">↩</a></p>" in "_site/text-and-footnote.html"
|
||||
And I should see "<p>Read <a href=\"docs.jekyll.com\">docs</a></p>" in "_site/text-and-reference-link.html"
|
||||
And I should see "<p>Check out <a href=\"jekyllrb.com\">jekyll</a></p>" in "_site/text-and-self-refencing-link.html"
|
||||
|
||||
@@ -207,3 +207,35 @@ Feature: Rendering
|
||||
And I should see "series named {{ site.title }}" in "_site/index.html"
|
||||
And I should see "{% link series/first-part.md %}" in "_site/index.html"
|
||||
And I should see "{% link series/last-part.md %}" in "_site/index.html"
|
||||
|
||||
Scenario: Render content of another page
|
||||
Given I have an "index.md" page that contains "__Hello World__"
|
||||
And I have an "about.md" page that contains "{{ page.name }}"
|
||||
And I have a "test.json" file with content:
|
||||
"""
|
||||
---
|
||||
---
|
||||
|
||||
{
|
||||
"hpages": [
|
||||
{%- for page in site.html_pages %}
|
||||
{
|
||||
"url" : {{ page.url | jsonify }},
|
||||
"name" : {{ page.name | jsonify }},
|
||||
"path" : {{ page.path | jsonify }},
|
||||
"title" : {{ page.title | jsonify }},
|
||||
"layout" : {{ page.layout | jsonify }},
|
||||
"content": {{ page.content | jsonify }},
|
||||
"excerpt": {{ page.excerpt | jsonify }}
|
||||
}{% unless forloop.last %},{% endunless -%}
|
||||
{% endfor %}
|
||||
]
|
||||
}
|
||||
"""
|
||||
When I run jekyll build
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
But I should not see "content\": \"{{ page.name }}" in "_site/test.json"
|
||||
And I should not see "content\": \"__Hello World__" in "_site/test.json"
|
||||
But I should see "content\": \"<p>about.md</p>" in "_site/test.json"
|
||||
And I should see "content\": \"<p><strong>Hello World</strong></p>" in "_site/test.json"
|
||||
|
||||
@@ -249,9 +249,6 @@ module Jekyll
|
||||
|
||||
def default_url(opts)
|
||||
config = configuration_from_options(opts)
|
||||
auth = config.values_at("host", "port").join(":")
|
||||
return config["url"] if auth == "127.0.0.1:4000"
|
||||
|
||||
format_url(
|
||||
config["ssl_cert"] && config["ssl_key"],
|
||||
config["host"] == "127.0.0.1" ? "localhost" : config["host"],
|
||||
|
||||
@@ -112,7 +112,11 @@ module Jekyll
|
||||
#
|
||||
# Returns the Hash representation of this Convertible.
|
||||
def to_liquid(attrs = nil)
|
||||
further_data = attribute_hash(attrs || self.class::ATTRIBUTES_FOR_LIQUID)
|
||||
further_data = \
|
||||
(attrs || self.class::ATTRIBUTES_FOR_LIQUID).each_with_object({}) do |attribute, hsh|
|
||||
hsh[attribute] = send(attribute)
|
||||
end
|
||||
|
||||
Utils.deep_merge_hashes defaults, Utils.deep_merge_hashes(data, further_data)
|
||||
end
|
||||
|
||||
@@ -246,13 +250,6 @@ module Jekyll
|
||||
@defaults ||= site.frontmatter_defaults.all(relative_path, type)
|
||||
end
|
||||
|
||||
def attribute_hash(attrs)
|
||||
@attribute_hash ||= {}
|
||||
@attribute_hash[attrs] ||= attrs.each_with_object({}) do |attribute, hsh|
|
||||
hsh[attribute] = send(attribute)
|
||||
end
|
||||
end
|
||||
|
||||
def no_layout?
|
||||
data["layout"] == "none"
|
||||
end
|
||||
|
||||
@@ -234,12 +234,17 @@ module Jekyll
|
||||
end
|
||||
|
||||
def add_include_to_dependency(inclusion, context)
|
||||
return unless context.registers[:page]&.key?("path")
|
||||
page = context.registers[:page]
|
||||
return unless page&.key?("path")
|
||||
|
||||
@site.regenerator.add_dependency(
|
||||
@site.in_source_dir(context.registers[:page]["path"]),
|
||||
inclusion.path
|
||||
)
|
||||
absolute_path = \
|
||||
if page["collection"]
|
||||
@site.in_source_dir(@site.config["collections_dir"], page["path"])
|
||||
else
|
||||
@site.in_source_dir(page["path"])
|
||||
end
|
||||
|
||||
@site.regenerator.add_dependency(absolute_path, inclusion.path)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
VERSION = "4.2.0"
|
||||
VERSION = "4.2.1"
|
||||
end
|
||||
|
||||
@@ -232,6 +232,12 @@ class TestCommandsServe < JekyllUnitTest
|
||||
expect(Jekyll).to receive(:env).and_return("development")
|
||||
expect(Jekyll::Commands::Serve).to receive(:start_up_webrick)
|
||||
end
|
||||
should "set the site url by default to `http://localhost:4000`" do
|
||||
@merc.execute(:serve, "watch" => false, "url" => "https://jekyllrb.com/")
|
||||
|
||||
assert_equal 1, Jekyll.sites.count
|
||||
assert_equal "http://localhost:4000", Jekyll.sites.first.config["url"]
|
||||
end
|
||||
|
||||
should "take `host`, `port` and `ssl` into consideration if set" do
|
||||
@merc.execute(:serve,
|
||||
|
||||
Reference in New Issue
Block a user