-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·55 lines (47 loc) · 1.45 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# ======= PROGRAMS AND FLAGS =======
RUBY := ruby
GEM := gem
RBENV := rbenv
ENV := env
BUNDLE := bundle
EXEC := exec
JEKYLL := jekyll
SERVE := serve --watch
BUILD := build
# ======= COLORS ===================
RED := \033[31m
GREEN := \033[32m
YELLOW := \033[33m
BLUE := \033[34m
NONE := \033[0m
# ======= COMMANDS =================
ECHO := echo -e
OPEN := xdg-open
# RULES
.PHONY: help env install install-ruby serve
help:
@$(ECHO) '$(YELLOW)Makefile help$(NONE)'
@$(ECHO) " \
* env : generates the virtual environment using the last version and rbenv\n \
* install : install the requirements listed in the Gemfile\n \
* install-ruby : install the last ruby version in rbenv\n \
* serve : build the site and make it available on a local server\n \
* build : build the site"
install-ruby:
@export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"
@$(RBENV) install $($(RBENV) install -l | grep -v - | tail -1)
@$(RBENV) local $($(RBENV) install -l | grep -v - | tail -1)
@$(GEM) install bundler
install:
@$(ECHO) '$(GREEN)Installing requirements..$(NONE)'
@$(BUNDLE) install
@$(ECHO) '$(GREEN)Done$(NONE)'
serve:
@$(ECHO) '$(BLUE)Building site and making it available locally..$(NONE)'
(sleep 5; $(OPEN) http://127.0.0.1:4000/rsbench/) &
@$(BUNDLE) $(EXEC) $(JEKYLL) $(SERVE)
@$(ECHO) '$(BLUE)Done$(NONE)'
build:
@$(ECHO) '$(BLUE)Building site..$(NONE)'
@$(BUNDLE) $(EXEC) $(JEKYLL) $(BUILD)
@$(ECHO) '$(BLUE)Done$(NONE)'