File: generate_docs.rb

package info (click to toggle)
ruby-concurrent 1.3.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,136 kB
  • sloc: ruby: 30,875; java: 6,128; ansic: 265; makefile: 26; sh: 19
file content (46 lines) | stat: -rw-r--r-- 1,117 bytes parent folder | download
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"