Skip to content

Commit

Permalink
Makefile: Prefer Ruby 2.7 if available
Browse files Browse the repository at this point in the history
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: xmonad#37
  • Loading branch information
liskin committed Mar 13, 2022
1 parent 116c2fe commit eb65e5d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit eb65e5d

Please sign in to comment.