forked from ruby/docs.ruby-lang.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbc-setup-all
executable file
·41 lines (32 loc) · 982 Bytes
/
bc-setup-all
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
#!/usr/bin/env ruby
VERSIONS = %w[
2.1.0
2.2.0
2.3.0
]
RUBY = "ruby"
BITCLUST_BASE = "/var/rubydoc/bitclust"
BITCLUST = "#{BITCLUST_BASE}/bin/bitclust"
BITCLUST_LIB_DIR = "#{BITCLUST_BASE}/lib"
DOC_BASE = "/var/rubydoc/doctree"
REF_BASE = "#{DOC_BASE}/refm"
def setup_db(version)
db = "#{REF_BASE}/db-#{version}"
`rm -rf #{db}`
`#{RUBY} -I#{BITCLUST_LIB_DIR} #{BITCLUST} -d #{db} init version=#{version} encoding=utf-8`
`#{RUBY} -I#{BITCLUST_LIB_DIR} #{BITCLUST} -d #{db} update --stdlibtree=#{REF_BASE}/api/src`
`#{RUBY} -I#{BITCLUST_LIB_DIR} #{BITCLUST} -d #{db} --capi update #{REF_BASE}/capi/src/*`
puts "#{version} is done"
end
if !File.directory?(BITCLUST_BASE)
`git clone https://github.com/rurema/bitclust.git #{BITCLUST_BASE}`
end
if !File.directory?(DOC_BASE)
`git clone https://github.com/rurema/doctree.git #{DOC_BASE}`
end
Dir.chdir(DOC_BASE) do
system "git pull --rebase"
end
VERSIONS.reverse_each do |version|
setup_db(version)
end