Compare commits

...

13 Commits

Author SHA1 Message Date
Ashwin Maroli
34ef47b590 Release 💎 v4.2.2 2022-03-03 16:16:33 +05:30
Ashwin Maroli
202c555acc Backport #8830 for v4.2.x: Add a workflow to build gems consistently (#8869)
Add a workflow to build gems consistently
This backports db3f034 to 4.2-stable
2021-12-09 21:54:27 +05:30
Ashwin Maroli
f2ecf63a12 Lock rubocop-performance to v1.11.x
To avoid running `Performance/DeletePrefix` and `Performance/DeleteSuffix`
cops since the codebase is still supported on Ruby 2.4
2021-12-09 20:29:02 +05:30
Ashwin Maroli
57387864aa Lock http_parser.rb gem to v0.6.x on JRuby
Since newer versions of the gem do not have a Java counterpart.
2021-12-09 20:22:18 +05:30
Ashwin Maroli
ce1db82dbb Release 💎 4.2.1 2021-09-27 16:25:58 +05:30
Ashwin Maroli
855544ab29 Update history to reflect merge of #8808 [ci skip] 2021-09-16 12:04:14 +05:30
Ashwin Maroli
29ecdbdec5 Merge pull request #8808 from ashmaroli/4.2-stable-backport-8620
Backport #8620 for v4.2.x: Revert #7253: "Don't reset site.url to localhost:4000 by default"
2021-09-16 11:59:11 +05:30
Ashwin Maroli
04f93171b8 Update history to reflect merge of #8794 [ci skip] 2021-09-16 11:11:21 +05:30
Ashwin Maroli
55a39dd568 Backport #8756 for v4.2.x: Respect collections_dir config within include tag (#8794)
Respect collections_dir config within include tag
This backports aa9a416 and 1aea158 to 4.2-stable
2021-09-16 11:07:24 +05:30
Ashwin Maroli
3c9a7eef5b Update history to reflect merge of #8793 [ci skip] 2021-09-16 10:24:44 +05:30
Ashwin Maroli
54010a784c Backport #8786 for v4.2.x (#8793)
Fix regression in Convertible module from v4.2.0
This backports eca4504 to 4.2-stable
2021-09-16 10:17:30 +05:30
Ben Keith
f73e8b16f8 Backport #8620 for v4.2.x
Revert #7253: "Don't reset site.url to localhost:4000 by default"
This backports faef38b to 4.2-stable
2021-09-15 20:25:57 +05:30
Ashwin Maroli
ba024ea1b7 Fix CI on 4.2-stable branch 2021-08-29 14:29:45 +05:30
18 changed files with 186 additions and 71 deletions

View File

@@ -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

34
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Release Gem
on:
push:
branches:
- master
- "*-stable"
paths:
- "lib/**/version.rb"
jobs:
release:
if: "github.repository_owner == 'jekyll'"
name: "Release Gem (Ruby ${{ matrix.ruby_version }})"
runs-on: "ubuntu-latest"
strategy:
fail-fast: true
matrix:
ruby_version:
- 2.7
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: "Set up Ruby ${{ matrix.ruby_version }}"
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- name: Build and Publish Gem
uses: ashmaroli/release-gem@dist
with:
gemspec_name: jekyll
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_GEM_PUSH_API_KEY }}

View File

@@ -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

View File

@@ -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:

View File

@@ -23,14 +23,17 @@ group :test do
gem "nokogiri", "~> 1.7"
gem "rspec"
gem "rspec-mocks"
gem "rubocop", "~> 1.0"
gem "rubocop-performance"
gem "rubocop", "~> 1.12.0"
gem "rubocop-performance", "~> 1.11.0"
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__)
gem "test-theme-skinny", :path => File.expand_path("test/fixtures/test-theme-skinny", __dir__)
gem "test-theme-symlink", :path => File.expand_path("test/fixtures/test-theme-symlink", __dir__)
gem "jruby-openssl" if RUBY_ENGINE == "jruby"
if RUBY_ENGINE == "jruby"
gem "http_parser.rb", "~> 0.6.0"
gem "jruby-openssl"
end
end
#

View File

@@ -1,3 +1,22 @@
## 4.2.2 / 2022-03-03
### Bug Fixes
* Lock `http_parser.rb` gem to `v0.6.x` on JRuby.
### Development Fixes
* Backport #8830 for v4.2.x: Add a workflow to build gems consistently (#8869)
* Lock `rubocop-performance` to `v1.11.x`.
## 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

View File

@@ -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

View File

@@ -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/).

View File

@@ -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

View File

@@ -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"

View File

@@ -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\">&#8617;</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"

View File

@@ -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"

View File

@@ -99,6 +99,9 @@ module Jekyll
# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]
# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
# do not have a Java counterpart.
gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]
RUBY
end

View File

@@ -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"],

View File

@@ -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

View File

@@ -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

View File

@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Jekyll
VERSION = "4.2.0"
VERSION = "4.2.2"
end

View File

@@ -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,