forked from jenkins-infra/jenkins.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
97 lines (77 loc) · 3.42 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
BUILD_DIR=build
OUTPUT_DIR=$(BUILD_DIR)/_site
AWESTRUCT_CONFIG=--source-dir=content --output-dir=$(OUTPUT_DIR)
ASSETS_DIR=$(OUTPUT_DIR)/assets/bower
VERSION=$(BUILD_NUMBER)-$(shell git rev-parse --short HEAD)
# Generate everything
all: fetch generate pdfs archive
prepare: fetch depends assets
# Run a local dev server on localhost:4242
run: warning depends-ruby assets
LISTEN=true ./scripts/ruby bundle exec awestruct --bind 0.0.0.0 --dev $(AWESTRUCT_CONFIG)
generate: warning $(OUTPUT_DIR) depends-ruby assets $(OUTPUT_DIR)/releases.rss pdfs
./scripts/ruby bundle exec awestruct --generate --verbose $(AWESTRUCT_CONFIG)
pdfs: $(OUTPUT_DIR)/user-handbook.pdf
$(OUTPUT_DIR)/user-handbook.pdf: $(OUTPUT_DIR) depends-ruby scripts/generate-handbook-pdf
./scripts/ruby scripts/generate-handbook-pdf $(BUILD_DIR)/user-handbook.adoc
./scripts/ruby bundle exec asciidoctor-pdf -a allow-uri-read \
--base-dir content \
--out-file user-handbook.pdf \
$(BUILD_DIR)/user-handbook.adoc
# Fetching and generating content from external sources
#######################################################
fetch: depends-ruby scripts/fetch-examples scripts/fetch-external-resources
./scripts/fetch-examples
./scripts/ruby bundle exec ./scripts/fetch-external-resources
$(OUTPUT_DIR)/releases.rss: $(OUTPUT_DIR) scripts/release.rss.groovy
./scripts/groovy scripts/release.rss.groovy 'https://updates.jenkins.io/release-history.json' > $(OUTPUT_DIR)/releases.rss
#######################################################
# Handling dependencies
#######################################################
depends: depends-ruby depends-node
depends-ruby: Gemfile
./scripts/ruby bundle install --path=vendor/gems
depends-node: package.json
./scripts/node npm install
assets: depends-node
mkdir -p $(ASSETS_DIR)
mkdir -p $(OUTPUT_DIR)/css/fonts
@for f in $(shell find node_modules \( -iname "*.eot" -o -iname "*.woff" -o -iname "*.ttf" \)); do \
echo ">> $$f => $(OUTPUT_DIR)/css/fonts/"; \
cp $$f $(OUTPUT_DIR)/css/fonts/; \
done;
@for d in bootstrap jquery tether; do \
echo ">> Copying node_modules/$$d/dist/* into $(ASSETS_DIR)/$$d/"; \
mkdir -p $(ASSETS_DIR)/$$d; \
cp -R node_modules/$$d/dist/* $(ASSETS_DIR)/$$d/ ; \
done;
mkdir -p $(ASSETS_DIR)/anchor-js/
cp node_modules/anchor-js/*.js $(ASSETS_DIR)/anchor-js/
mkdir -p $(ASSETS_DIR)/ionicons
cp -R node_modules/ionicons/css $(ASSETS_DIR)/ionicons
cp -R node_modules/ionicons/fonts $(ASSETS_DIR)/ionicons
#######################################################
# Archive tasks
#######################################################
archive: $(OUTPUT_DIR)
mkdir -p $(BUILD_DIR)/archives
(cd $(BUILD_DIR) && \
ln -s _site jenkins.io-$(VERSION) && \
zip --quiet -r archives/jenkins.io-$(VERSION).zip jenkins.io-$(VERSION))
#######################################################
# Miscellaneous tasks
#######################################################
$(OUTPUT_DIR):
mkdir -p $(OUTPUT_DIR)
warning:
@echo '-------------------------------------------------------------'
@echo ">> To save time, this won't automatically run \`make fetch\`."
@echo ">> Please ensure you have run \`make fetch\` at least once"
@echo '-------------------------------------------------------------'
clean:
rm -rf vendor/gems
rm -rf build/
rm -rf node_modules/
#######################################################
.PHONY: all clean depends depends-node depends-ruby generate run \
fetch warning pdfs assets prepare archive