This repository has been archived by the owner on May 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.rb
81 lines (66 loc) · 2.53 KB
/
build.rb
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
#!/usr/bin/env ruby
require 'fileutils'
PLATFORMS=["kubernetes", "openshift"]
VERSIONS=["master", "0.31.2", "0.30.2", "0.29.2"]
LATEST_VERSION=VERSIONS[1]
OLD_VERSIONS=VERSIONS.drop(2)
DL_PREFIX="https://github.com/EnMasseProject/enmasse/releases/tag"
docsmaster=VERSIONS[0]
# Write documentation menu file
MENU_TEMPLATE="_data/menus-header.yml"
MENU_FILE="_data/menus.yml"
FileUtils.copy_file(MENU_TEMPLATE, MENU_FILE)
menus = File.open(MENU_FILE, "a")
PLATFORMS.each do |platform|
menus.puts("#{platform}docslatest:")
menus.puts(" - url: /documentation/#{LATEST_VERSION}/#{platform}")
menus.puts(" title: #{LATEST_VERSION}")
menus.puts(" identifier: #{LATEST_VERSION}-#{platform}")
menus.puts("#{platform}docsall:")
[docsmaster, LATEST_VERSION].each do |version|
menus.puts(" - url: /documentation/#{version}/#{platform}")
menus.puts(" title: #{version}")
menus.puts(" identifier: #{version}-#{platform}")
end
menus.puts("#{platform}docsolder:")
OLD_VERSIONS.each do |version|
menus.puts(" - url: /documentation/#{version}/#{platform}")
menus.puts(" title: #{version}")
menus.puts(" identifier: #{version}-#{platform}")
end
menus.puts("#{platform}docsmaster:")
menus.puts(" - url: /documentation/#{docsmaster}/#{platform}")
menus.puts(" title: latest")
menus.puts(" identifier: latest-#{platform}")
end
menus.puts("dllatest:")
menus.puts(" - url: #{DL_PREFIX}/#{LATEST_VERSION}")
menus.puts(" title: #{LATEST_VERSION}")
menus.puts(" identifier: #{LATEST_VERSION}")
menus.puts("dlolder:")
OLD_VERSIONS.each do |version|
menus.puts(" - url: #{DL_PREFIX}/#{version}")
menus.puts(" title: #{version}")
menus.puts(" identifier: #{version}")
end
menus.close()
# Copy documentation folder
ENMASSE_REPO="https://github.com/EnMasseProject/enmasse.git"
CHECKOUT_DIR="enmasse"
if not File.exists?(CHECKOUT_DIR)
`git clone #{ENMASSE_REPO} #{CHECKOUT_DIR}`
end
VERSIONS.each do |version|
puts("Generating for #{version}")
`git -C #{CHECKOUT_DIR} checkout #{version}`
`git -C #{CHECKOUT_DIR} pull --rebase`
# Generate RESTAPI reference
`make SKIP_TESTS=true -C #{CHECKOUT_DIR}/api-server`
`make -C #{CHECKOUT_DIR} docu_html`
PLATFORMS.each do |platform|
doc_folder = "documentation/#{version}/#{platform}"
FileUtils.rm_rf(doc_folder)
FileUtils.mkdir_p("documentation/#{version}")
FileUtils.cp_r("#{CHECKOUT_DIR}/documentation/html/#{platform}", doc_folder)
end
end