-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathdocusaurus.rb
More file actions
122 lines (95 loc) · 4.24 KB
/
docusaurus.rb
File metadata and controls
122 lines (95 loc) · 4.24 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
Jekyll::Hooks.register :site, :post_write do |page|
Dir.chdir("docusaurus") do
system!("npm install")
system!("npm run build")
end
system!("cp -R docusaurus/build/img _site")
system!("cp -R docusaurus/build/assets _site")
system!("mkdir -p _site/search")
system!("cp docusaurus/build/search/index.html _site/search")
system!("mkdir -p _site/knapsack_pro-ruby/guide")
system!("cp docusaurus/build/knapsack_pro-ruby/guide/index.html _site/knapsack_pro-ruby/guide")
system!("mkdir -p _site/cypress/guide")
system!("cp docusaurus/build/cypress/guide/index.html _site/cypress/guide")
system!("mkdir -p _site/cypress/reference")
system!("cp docusaurus/build/cypress/reference/index.html _site/cypress/reference")
system!("mkdir -p _site/cypress/cookbook")
system!("cp docusaurus/build/cypress/cookbook/index.html _site/cypress/cookbook")
system!("mkdir -p _site/cypress/troubleshooting")
system!("cp docusaurus/build/cypress/troubleshooting/index.html _site/cypress/troubleshooting")
system!("mkdir -p _site/jest/guide")
system!("cp docusaurus/build/jest/guide/index.html _site/jest/guide")
system!("mkdir -p _site/jest/reference")
system!("cp docusaurus/build/jest/reference/index.html _site/jest/reference")
system!("mkdir -p _site/jest/cookbook")
system!("cp docusaurus/build/jest/cookbook/index.html _site/jest/cookbook")
system!("mkdir -p _site/jest/troubleshooting")
system!("cp docusaurus/build/jest/troubleshooting/index.html _site/jest/troubleshooting")
system!("mkdir -p _site/vitest/guide")
system!("cp docusaurus/build/vitest/guide/index.html _site/vitest/guide")
system!("mkdir -p _site/vitest/reference")
system!("cp docusaurus/build/vitest/reference/index.html _site/vitest/reference")
system!("mkdir -p _site/vitest/cookbook")
system!("cp docusaurus/build/vitest/cookbook/index.html _site/vitest/cookbook")
system!("mkdir -p _site/vitest/troubleshooting")
system!("cp docusaurus/build/vitest/troubleshooting/index.html _site/vitest/troubleshooting")
system!("mkdir -p _site/playwright/guide")
system!("cp docusaurus/build/playwright/guide/index.html _site/playwright/guide")
system!("mkdir -p _site/playwright/reference")
system!("cp docusaurus/build/playwright/reference/index.html _site/playwright/reference")
system!("mkdir -p _site/playwright/cookbook")
system!("cp docusaurus/build/playwright/cookbook/index.html _site/playwright/cookbook")
system!("mkdir -p _site/playwright/troubleshooting")
system!("cp docusaurus/build/playwright/troubleshooting/index.html _site/playwright/troubleshooting")
system!("mkdir -p _site/integration")
system!("cp docusaurus/build/integration/index.html _site/integration") # redirect to /
system!("cp docusaurus/build/index.html _site")
system!("mkdir -p _site/overview")
system!("cp docusaurus/build/overview/index.html _site/overview")
system!("mkdir -p _site/troubleshooting")
system!("cp docusaurus/build/troubleshooting/index.html _site/troubleshooting")
system!("mkdir -p _site/ruby")
[
"capybara",
"circleci",
"code-climate",
"cookbook",
"cucumber",
"encryption",
"heroku",
"hooks",
"parallel_tests",
"puffing-billy",
"predict",
"queue-mode",
"reference",
"retry-only-failures",
"rspec",
"simplecov",
"split-by-test-examples",
"spring",
"troubleshooting",
].each do |directory|
system!("cp -R docusaurus/build/ruby/#{directory} _site/ruby")
end
system!("mkdir -p _site/ruby/knapsack")
system!("cp docusaurus/build/ruby/knapsack/index.html _site/ruby/knapsack") # redirect to https://github.com/KnapsackPro/knapsack
system!("mv _site/sitemap.xml _site/jekyll-sitemap.xml")
system!("cp docusaurus/build/sitemap.xml _site/docusaurus-sitemap.xml")
File.open("_site/sitemap.xml", "w") do |file|
file.write <<~HEREDOC
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://docs.knapsackpro.com/jekyll-sitemap.xml</loc>
</sitemap>
<sitemap>
<loc>https://docs.knapsackpro.com/docusaurus-sitemap.xml</loc>
</sitemap>
</sitemapindex>
HEREDOC
end
end