Skip to content

Commit 7a0ab3d

Browse files
committed
Upgrade Ruby to 3.3 and Jekyll to 4.3
Jekyll comes with the jekyll-sass-converter plugin, so most of the work in this commit is switching to that gem, which expects an _sass directory by default. Also, that gem does not support sprockets, so we need to do some manual handling of the various sass gems to include their stylesheets and other assets (fonts) in the proper directories. Fixes #878
1 parent d577568 commit 7a0ab3d

37 files changed

+50
-9
lines changed

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Ruby
2020
uses: ruby/setup-ruby@v1
2121
with:
22-
ruby-version: '2.7'
22+
ruby-version: '3.3'
2323
bundler-cache: true
2424
timeout-minutes: 30
2525
- name: Build

Gemfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
source 'https://rubygems.org'
22

3+
ruby "~> 3.3.6"
4+
35
gem "activesupport", ">= 5.2.7", :require => false
46
gem "bootstrap-sass", "~> 3.x"
57
gem "font-awesome-sass", "~> 4.x"
6-
gem "jekyll", "~> 3.x"
7-
gem "jekyll-assets", "< 3" # jekyll-assets 3.0.12 brings in sprockets 4 which has a bug: See https://github.com/envygeeks/jekyll-assets/pull/636
8+
gem "jekyll", "~> 4.3"
89
gem "jekyll-coffeescript"
910
gem "jekyll-paginate"
11+
gem "jekyll-sass-converter"
1012
gem "jekyll-sitemap"
1113
gem "jemoji"
1214
gem "kramdown-parser-gfm"

lib/miq/executor.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def run_cmd_with_bundle_env(cmd, clean)
5252
success =
5353
if clean || (cmd =~ /cd\ /)
5454
env = ENV.to_h.slice("BUNDLE_WITHOUT", "MIQ_DEBUG", "MIQ_ENV")
55-
Bundler.clean_system(env, cmd)
55+
Bundler.unbundled_system(env, cmd)
5656
else
5757
system(cmd)
5858
end

site/_config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
plugins:
99
- jekyll-coffeescript
10-
- jekyll-assets
1110
- jekyll-paginate
11+
- jekyll-sass-converter
1212
- jekyll-sitemap
1313
- jemoji
1414

site/_includes/head.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222
</script>
2323

24-
{% css main %}
24+
<link rel="stylesheet" href="/assets/css/main.css">
2525
<link rel="canonical" href="{{ page.canonical_url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
2626
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}">
2727

site/_plugins/font_generator.rb

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
require "font-awesome-sass"
2+
3+
module Jekyll
4+
module FontAwesomeSass
5+
class Generator < Jekyll::Generator
6+
def generate(site)
7+
@site = site
8+
@site.static_files.concat(font_files)
9+
end
10+
11+
def font_files
12+
assets_path = FontAwesome::Sass.assets_path
13+
source = FontAwesome::Sass.gem_path
14+
Dir.glob(File.join(assets_path, "fonts/font-awesome/*")).map do |font|
15+
font = font.sub(assets_path, "assets")
16+
dir = File.dirname(font)
17+
file_name = File.basename(font)
18+
Jekyll::StaticFile.new(@site, source, dir, file_name)
19+
end
20+
end
21+
end
22+
end
23+
end

site/_plugins/sass_loader.rb

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require "jekyll/converters/scss"
2+
require "bootstrap-sass"
3+
require "font-awesome-sass"
4+
5+
# sass/load_paths configuration in _config.yml only supports hardcoded paths,
6+
# so we override to add in the paths from the gems dynamically.
7+
module SassLoader
8+
def user_sass_load_paths
9+
super + [
10+
Bootstrap.stylesheets_path,
11+
FontAwesome::Sass.stylesheets_path
12+
]
13+
end
14+
end
15+
16+
Jekyll::Converters::Scss.prepend(SassLoader)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

site/_assets/css/main.scss site/assets/css/main.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
---
2+
---
3+
14
@charset "utf-8";
25

36
$font-size-base: 16px;
47

5-
@import "font-awesome-sprockets";
6-
@import "bootstrap-sprockets";
7-
88
@import "font-awesome";
99
@import "twbs_custom";
1010
@import "twbs_overrides";

0 commit comments

Comments
 (0)