Skip to content

Commit d84263f

Browse files
committed
Add Rakefile for documentation site management with serve and install tasks
Signed-off-by: HAHWUL <[email protected]>
1 parent 56b3f8d commit d84263f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Rakefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# frozen_string_literal: true
2+
3+
namespace :docs do
4+
desc 'Serve the documentation site'
5+
task :serve do
6+
within_docs_directory do
7+
unless system('bundle check')
8+
puts "Bundler is not installed or dependencies are not met. Please run 'rake docs:install'."
9+
exit 1
10+
end
11+
12+
sh 'bundle exec jekyll s'
13+
end
14+
end
15+
16+
desc 'Install dependencies for the documentation site'
17+
task :install do
18+
within_docs_directory do
19+
sh 'bundle install'
20+
end
21+
end
22+
23+
def within_docs_directory(&block)
24+
Dir.chdir('docs', &block)
25+
rescue Errno::ENOENT => e
26+
puts "Directory 'docs' not found: #{e.message}"
27+
exit 1
28+
rescue StandardError => e
29+
puts "An error occurred: #{e.message}"
30+
exit 1
31+
end
32+
end

0 commit comments

Comments
 (0)