forked from lfe-deprecated/plan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (58 loc) · 1.66 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
ARCHFLAGS = -Wno-error=unused-command-line-argument-hard-error-in-future
SRC = ./src
BASE_DIR = $(shell pwd)
BUILD_DIR = $(BASE_DIR)/build
REPO = $(shell git config --get remote.origin.url)
STAGING_HOST = staging-plan.lfe.io
STAGING_PATH = /var/www/lfe/staging-plan
OS := $(shell uname -s)
ifeq ($(OS),Linux)
HOST = $(HOSTNAME)
GEM = sudo gem
NEW_PATH = $(PATH)
endif
ifeq ($(OS),Darwin)
HOST = $(shell scutil --get ComputerName)
GEM = gem
GEM_PATH = /Users/rv/.gem/ruby/2.0.0/bin
NEW_PATH = $(PATH):$(GEM_PATH)
endif
build:
@mkdir -p $(BUILD_DIR)
cd $(SRC) && \
bundle exec jekyll build --destination $(BUILD_DIR)
ubuntu-deps:
sudo apt-get install -y nodejs nodejs-dev
new:
@OUT=$$(cd $(SRC); PATH=$(NEW_PATH) $(NEW_CMD)) ; \
$(EDITOR) $(SRC)/$$(echo $$OUT | cut -d ' ' -f 4-)
post:
@make new
update-gems:
cd $(SRC) && PATH=$(PATH):$(GEM_PATH) && ARCHFLAGS=$(ARCHFLAGS) \
$(GEM) update --system
install-jekyll: update-gems
cd $(SRC) && PATH=$(PATH):$(GEM_PATH) && ARCHFLAGS=$(ARCHFLAGS) \
$(GEM) install bundler
cd $(SRC) && PATH=$(PATH):$(GEM_PATH) && ARCHFLAGS=$(ARCHFLAGS) \
bundle install
update: install-jekyll
cd $(SRC) && PATH=$(PATH):$(GEM_PATH) && ARCHFLAGS=$(ARCHFLAGS) \
bundle update
clean:
rm -rf $(BUILD_DIR)
run:
cd $(SRC) && \
bundle exec jekyll serve --destination $(BUILD_DIR)
staging: clean build
git pull --all && \
rsync -azP $(BUILD_DIR)/* $(STAGING_HOST):$(STAGING_PATH)
make clean
publish: clean build
-@git commit -a; git push origin master
@rm -rf $(BUILD_DIR)/.git
@cd $(BUILD_DIR) && \
git init && \
git add * > /dev/null && \
git commit -a -m "Generated content." > /dev/null && \
git push -f $(REPO) master:gh-pages