web icon indicating copy to clipboard operation
web copied to clipboard

Moving to Ruby 3.0, Jekyll 4

Open eguiraud opened this issue 2 years ago • 6 comments

Our website build process depends on the github-pages gem, which does not support Jekyll 4 so we are stuck at Jekyll 3.9, and Jekyll 3.9 does not work with ruby 3, so we are stuck with ruby 2.7.

Ruby 2.7 died 2 months ago.

Building our site with Ruby 3.0 is possible, but we have to drop the dependency on the github-pages gem.

This Gemfile works for me with Ruby 3.0.5 and Jekyll 4.3.2 (with the caveat that I have not done extensive testing):

source "https://rubygems.org"

# Use the latest version.
gem "jekyll"
gem "webrick"

group :jekyll_plugins do
  gem "jekyll-paginate"
  gem "jekyll-sitemap"
  gem "jekyll-gist"
  gem "jekyll-feed"
  gem "jekyll-include-cache"
  gem "jekyll-liquify"
  gem "jekyll-archives"
  gem "jekyll-remote-theme"
end

There are also a couple of SCSS deprecation warnings but they seem easy to fix.

EDIT:

the warnings are coming from our fork of the minimal-mistakes theme and I fixed them in https://github.com/root-project/minimal-mistakes/pull/22 .

eguiraud avatar Jun 09 '23 01:06 eguiraud

Building our site with Ruby 3.0 is possible

Looks like building out side with Ruby 3.1 is now required: https://github.com/root-project/web/actions/runs/7005437970/job/19055168177?pr=924#step:4:194

+ bundle exec jekyll build --baseurl=924/ --destination build/924
bundler: failed to load command: jekyll (/usr/gem/bin/jekyll)
/usr/gem/gems/jekyll-liquify-0.0.3/lib/jekyll-liquify.rb:15:in `<top (required)>': uninitialized constant LiquidFilter (NameError)

Liquid::Template.register_filter(LiquidFilter)
                                 ^^^^^^^^^^^^
	from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:60:in `require'
	from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
	from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:55:in `each'
	from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:55:in `block in require'
	from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:44:in `each'
	from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/runtime.rb:44:in `require'
	from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler.rb:186:in `require'
	from /usr/gem/gems/jekyll-3.9.3/lib/jekyll/plugin_manager.rb:51:in `require_from_bundler'
	from /usr/gem/gems/jekyll-3.9.3/exe/jekyll:11:in `<top (required)>'
	from /usr/gem/bin/jekyll:25:in `load'

No new webpages until this is fixed. @couet could you please follow what Enrico suggests here and there and see whether that makes things work? It cannot get much more broken than now, so please be courageous.

Best would be to rebase our minimal-mistakes commits on top of upstream's master.

Axel-Naumann avatar Nov 27 '23 22:11 Axel-Naumann

Hi @eguiraud I am running with ruby 3 since a long time and I need to have my now Gemfile to be able to build the web site locally on my machine. My local Gemfile is:

source "https://rubygems.org"

gem "github-pages", group: :jekyll_plugins
gem "webrick"

# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-paginate"
  gem "jekyll-sitemap"
  gem "jekyll-gist"
  gem "jekyll-feed"
  gem "jekyll-include-cache"
  gem "jekyll-liquify"
end

The only difference with the current Gemfile is the line:

gem "webrick"

I see your proposed GEmfile has more modifications. Are they really needed ? I can build the ROOT website locally with ruby 3 with only this extra line.

couet avatar Nov 28 '23 08:11 couet

Actually forget my comment, the Gemfile file I have on my Mac book is very close to the one you propose. The one I was talking about just before is on my IMac. I'll test yours on my MacBook

couet avatar Nov 28 '23 08:11 couet

The only difference between your GEmfile and the one I have on my MacBook is the that you changed the line:

gem "github-pages", group: :jekyll_plugins

By the line

gem "jekyll"

If I do that (use gem "jekyll") then the web site doesn't not build locally for me. I guess I can make a PR with the Gemfile I have on my MacBook and see what it does ...

couet avatar Nov 28 '23 09:11 couet

On my Mac I have:

% jekyll --version
jekyll 4.3.2
% ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin21]

And the web site builds fine with the Gemfile posted here: https://github.com/root-project/web/pull/925

The PR does not work and gives the error:

bundler: failed to load command: jekyll (/usr/gem/bin/jekyll)
/usr/gem/gems/jekyll-liquify-0.0.3/lib/jekyll-liquify.rb:15:in `<top (required)>': uninitialized constant LiquidFilter (NameError)

Liquid::Template.register_filter(LiquidFilter)

couet avatar Nov 28 '23 09:11 couet

Turns out (thanks @couet !) that jekyll-liquify v0.0.3 doesn't work for us, only 0.0.2 does. Forcing 0.0.2 fixes the current build problems - but this issue here remains and needs to be addressed (e.g. by https://github.com/root-project/web/pull/931)

Axel-Naumann avatar Nov 28 '23 23:11 Axel-Naumann