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
·53 lines (42 loc) · 1.29 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env ruby
require 'fileutils'
VERSIONS = %w[
3.0
3.1
3.2
3.3
3.4
]
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 = "refm" # was "#{DOC_BASE}/refm"
def setup_db(version)
Dir.chdir(DOC_BASE) do
db = "#{REF_BASE}/db-#{version}"
FileUtils.rm_rf db
system(*%W"#{RUBY} -I#{BITCLUST_LIB_DIR} #{BITCLUST} -d #{db} init version=#{version} encoding=utf-8")
system(*%W"#{RUBY} -I#{BITCLUST_LIB_DIR} #{BITCLUST} -d #{db} update --stdlibtree=#{REF_BASE}/api/src")
system(*%W"#{RUBY} -I#{BITCLUST_LIB_DIR} #{BITCLUST} -d #{db} --capi update" + Dir.glob("#{REF_BASE}/capi/src/*"))
puts "#{version} is done"
end
end
if !File.directory?(BITCLUST_BASE)
system(*%W"git clone --depth 1 https://github.com/rurema/bitclust.git #{BITCLUST_BASE}")
end
if !File.directory?(DOC_BASE)
system(*%W"git clone --depth 1 https://github.com/rurema/doctree.git #{DOC_BASE}")
end
Dir.chdir(BITCLUST_BASE) do
system(*%w"git fetch origin")
system(*%w"git reset origin/master --hard")
end
Dir.chdir(DOC_BASE) do
system(*%w"git fetch origin")
system(*%w"git reset origin/master --hard")
end
VERSIONS.reverse_each do |version|
setup_db(version)
end