forked from owasp-noir/noir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
54 lines (47 loc) · 1.18 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
45
46
47
48
49
50
51
52
53
54
namespace :docs do
desc "Serve the documentation site"
task :serve do
within_docs_directory do
unless system('bundle check')
puts "Bundler is not installed or dependencies are not met. Please run 'rake docs:install'."
exit 1
end
sh 'bundle exec jekyll s'
end
end
desc "Install dependencies for the documentation site"
task :install do
within_docs_directory do
sh 'bundle install'
end
end
desc "Generate usage documentation"
task :generate_usage do
output = `./bin/noir -h`
cleaned_output = output.gsub(/\e\[[0-9;]*m/, '') # Remove ANSI color codes
File.write('docs/_includes/usage.md', cleaned_output)
end
def within_docs_directory
Dir.chdir('docs') do
yield
end
rescue Errno::ENOENT => e
puts "Directory 'docs' not found: #{e.message}"
exit 1
rescue => e
puts "An error occurred: #{e.message}"
exit 1
end
end
namespace :lint do
desc "Format the code using crystal tool format"
task :format do
sh 'crystal tool format'
end
desc "Lint the code using ameba"
task :ameba do
sh 'ameba --fix'
end
desc "Run all linting tasks"
task :all => [:format, :ameba]
end