From eb65e5d425af5f1072a6197051d8cea3afd41413 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Fri, 11 Mar 2022 16:26:41 +0000 Subject: [PATCH] Makefile: Prefer Ruby 2.7 if available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ruby 3.0, which is now default in Debian (and likely many other distros), isn't officially supported by the github/pages-gem and some of its dependencies (despite patches being available for over a year—WTF), so `make serve` doesn't work. As a workaround, prefer Ruby 2.7 (the "bundle2.7" command on Debian-based distros, "bundle-2.7" on Arch) if available. Related: https://github.com/xmonad/xmonad-web/issues/37 --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 967a4c9..bc24e9a 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,19 @@ +# Prefer Ruby 2.7, github/pages-gem doesn't support 3.0 yet. +# (see https://github.com/xmonad/xmonad-web/issues/37 for details) +BUNDLE := $(firstword $(shell command -v bundle2.7 bundle-2.7) bundle) + export BUNDLE_PATH ?= $(CURDIR)/.bundle/gems .PHONY: build build: .bundle/.done - bundle exec jekyll build --drafts + $(BUNDLE) exec jekyll build --drafts .PHONY: serve serve: .bundle/.done - bundle exec jekyll serve --drafts --livereload + $(BUNDLE) exec jekyll serve --drafts --livereload .bundle/.done: Gemfile - bundle install + $(BUNDLE) install touch $@ .PHONY: clean