aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Makefile
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-05-05 02:07:32 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-05-05 02:07:32 +0300
commit8a13ff2c6821643e8df08cc0d7731e4b938e9edb (patch)
treea685a5ea1443acdf0847ca5ff57159b472382b69 /Makefile
parentUPPERCASE user-facing parameters (diff)
downloadjekyll-docker-8a13ff2c6821643e8df08cc0d7731e4b938e9edb.tar.gz
jekyll-docker-8a13ff2c6821643e8df08cc0d7731e4b938e9edb.zip
enable out-of-tree builds
This directory must not be a subdirectory of the Jekyll project anymore. The hacks I had to put in place for this will be documented in the next commit.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 12 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 81fda6c..6b9dee4 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ SHELL := bash
makefile_dir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
-PROJECT_DIR := $(abspath $(dir $(makefile_dir))/..)
+PROJECT_DIR ?= $(abspath $(dir $(makefile_dir))/..)
RUBY_INSTALL_VERSION ?= 0.7.0
RUBY_VERSION ?= 2.6.5
CHRUBY_VERSION ?= 0.3.9
@@ -22,6 +22,7 @@ auto_sh := $(PREFIX)/share/chruby/auto.sh
ruby_install_url := https://github.com/postmodern/ruby-install/archive/v$(RUBY_INSTALL_VERSION).tar.gz
ruby_install_archive := $(makefile_dir)/ruby-install-$(RUBY_INSTALL_VERSION).tar.gz
ruby_install_dir := $(makefile_dir)/ruby-install-$(RUBY_INSTALL_VERSION)
+
.PHONY: chruby
chruby:
wget -O '$(chruby_archive)' '$(chruby_url)'
@@ -70,7 +71,10 @@ ruby-install/clean:
ruby:
ruby-install -j2 --cleanup ruby '$(RUBY_VERSION)'
-chruby := cd -- '$(PROJECT_DIR)' && . '$(chruby_sh)' && chruby 'ruby-$(RUBY_VERSION)'
+chruby := . '$(chruby_sh)' && chruby 'ruby-$(RUBY_VERSION)'
+project_chruby := cd -- '$(PROJECT_DIR)' && $(chruby)
+bundle := $(project_chruby) && bundle
+jekyll := $(bundle) exec jekyll
.PHONY: bundler
bundler:
@@ -78,13 +82,11 @@ bundler:
.PHONY: dependencies
dependencies:
- $(chruby) && bundle install --jobs=2 --retry=3
+ $(bundle) install --jobs=2 --retry=3
.PHONY: deps
deps: dependencies
-jekyll := $(chruby) && bundle exec jekyll
-
.PHONY: jekyll/build
jekyll/build:
$(jekyll) build --config _config.yml,_config_dev.yml
@@ -93,7 +95,9 @@ jekyll/build:
jekyll/serve:
$(jekyll) serve --host 0.0.0.0 --config _config.yml,_config_dev.yml
-docker_compose := cd -- '$(makefile_dir)' && docker-compose
+# Not an absolute path, cause you know, Windows (more specifically, Cygwin +
+# native Windows docker-compose).
+docker_compose := cd -- '$(makefile_dir)' && docker-compose --env-file ./.env
.PHONY: docker/build
docker/build:
@@ -101,7 +105,7 @@ docker/build:
.PHONY: docker/up
docker/up:
- $(docker_compose) up -d
+ $(docker_compose) up -d project
.PHONY: docker/down
docker/down:
@@ -109,7 +113,7 @@ docker/down:
.PHONY: docker/shell
docker/shell:
- $(docker_compose) exec serve bash --login
+ $(docker_compose) exec project bash --login
.PHONY: docker/clean
docker/clean: