-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRakefile
44 lines (37 loc) · 1.15 KB
/
Rakefile
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
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
# rubocop:disable Lint/SuppressedException
begin
require "fileutils"
require "yard"
require "yard/rake/yardoc_task"
YARD::Rake::YardocTask.new do |t|
# rubocop:disable Style/IfUnlessModifier
if ENV["YARD_CACHE"] == "true"
t.options = t.options + ["--use-cache"]
end
# rubocop:enable Style/IfUnlessModifier
end
desc "Generate Yard and Hugo Site"
task :docsite => :yard do
FileUtils.cp_r "./doc", "./hugo/static/", preserve: false
build_command = "hugo"
if ENV["NVM_VERSION"]
nvm_v = ENV["NVM_VERSION"]
build_command = "nvm use #{nvm_v} && " + build_command
end
hugo_result = system("bash -lc '#{build_command}'", chdir: "./hugo")
exit(-1) unless hugo_result
end
desc "Serve the hugo site locally"
task :docserver => :yard do
FileUtils.cp_r "./doc", "./hugo/static/", preserve: false
build_command = "hugo serve"
system("bash -lc '#{build_command}'", chdir: "./hugo")
end
rescue LoadError
end
# rubocop:enable Lint/SuppressedException