-
Notifications
You must be signed in to change notification settings - Fork 9
/
Rakefile
50 lines (39 loc) · 1.14 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
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rubocop/rake_task"
require "rainbow"
require_relative "./spec/generate_creds"
require_relative "lib/tasks/support/shell_command"
RSpec::Core::RakeTask.new(:spec)
task default: %i[spec rubocop security]
# Prepare the project for testing
namespace :tests do
task prepare: %i[build fixtures]
end
task :build_java do
sh "make -C src build"
end
task :fixtures do
generate_test_creds
end
task :docs do
sh "make -C docs html"
end
desc "Run RuboCop on the lib directory"
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = ["lib/**/*.rb", "spec/**/*.rb"]
# Trigger failure for CI
task.fail_on_error = true
end
desc "Run bundle-audit to check for insecure dependencies"
task :security do
exit!(1) unless ShellCommand.run("bundle-audit update")
audit_result = ShellCommand.run("bundle-audit check")
unless audit_result
puts Rainbow("Failed. Security vulnerabilities were found.").red
exit!(1)
end
puts Rainbow("Passed. No obvious security vulnerabilities.").green
end
Rake::Task[:build].prerequisites << Rake::Task[:build_java]