-
-
Notifications
You must be signed in to change notification settings - Fork 445
/
Copy pathRakefile
58 lines (50 loc) · 1.35 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
55
56
57
58
# frozen_string_literal: true
require 'rspec/core/rake_task'
namespace :test do
desc 'Set up the test environment for functional tests'
task :functional_setup do
sh 'go mod vendor'
sh 'go build -o dalfox .' # Explicitly name the output binary
end
desc 'Run the functional tests'
RSpec::Core::RakeTask.new(functional: :functional_setup) do |t|
t.pattern = 'spec/functional_tests/**/*_spec.rb'
t.verbose = true # More output for debugging
end
desc 'Run the unit tests'
task :unit do
sh 'go test ./...'
end
desc 'Run all tests'
task :all do
Rake::Task['test:functional'].invoke
Rake::Task['test:unit'].invoke
end
end
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
def within_docs_directory(&block)
Dir.chdir('docs', &block)
rescue Errno::ENOENT => e
puts "Directory 'docs' not found: #{e.message}"
exit 1
rescue StandardError => e
puts "An error occurred: #{e.message}"
exit 1
end
end