-
Notifications
You must be signed in to change notification settings - Fork 416
/
Copy pathgenerate_docs.rb
46 lines (36 loc) · 1.09 KB
/
generate_docs.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
# Using Ruby 2.6 to run this as the docs of 1.1.5 need it
root = File.dirname(__dir__)
versions_file = "#{root}/docs-source/signpost.md"
# Note: 1.0.5 and 1.1.4 are too old, and use different rake task names
versions = File.read(versions_file).scan(/\[(\d+\.\d+\.\d+) with/).map(&:first)
versions.reverse!
def sh(*args)
command = "$ #{args.join(' ')}"
puts command
unless system(*args, exception: true)
raise "Failed: #{command}"
end
end
sh "rm", "-rf", "site"
sh "mkdir", "site"
versions.each do |version|
puts
puts version
sh "git", "checkout", "v#{version}"
has_docs = Dir.exist?('docs')
sh "rm", "-f", "Gemfile.lock"
sh "bundle", "install"
sh "bundle", "exec", "rake", "yard:#{version}"
sh "cp", "-R", "docs/#{version}", "site"
sh "rm", "-rf", "docs/#{version}"
sh "git", "restore", "docs" if has_docs
sh "git", "restore", "docs-source"
end
sh "git", "checkout", "master"
sh "rm", "-f", "Gemfile.lock"
sh "bundle", "install"
sh "bundle", "exec", "rake", "yard"
versions.each do |version|
sh "cp", "-R", "site/#{version}", "docs/#{version}"
end
sh "rm", "-rf", "site"