-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRakefile
More file actions
54 lines (42 loc) · 1.22 KB
/
Rakefile
File metadata and controls
54 lines (42 loc) · 1.22 KB
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
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rubocop/rake_task"
require "rake/extensiontask"
require "rake/testtask"
GEMSPEC = Gem::Specification.load("rubydex.gemspec")
Rake::ExtensionTask.new("rubydex", GEMSPEC) do |ext|
ext.lib_dir = "lib/rubydex"
end
test_config = lambda do |t|
t.libs << "test"
t.libs << "lib"
t.ruby_opts << ["--enable=frozen_string_literal"]
t.test_files = FileList["test/**/*_test.rb"]
end
Rake::TestTask.new(ruby_test: :compile, &test_config)
begin
require "ruby_memcheck"
namespace(:ruby_test) { RubyMemcheck::TestTask.new(valgrind: :compile, &test_config) }
rescue LoadError
# ruby_memcheck is not available on Windows
end
RuboCop::RakeTask.new
task :lint do
puts "******** Linting ********\n"
Rake::Task["rubocop"].invoke
Rake::Task["lint_rust"].invoke
end
task :format do
puts "******** Formatting ********\n"
Rake::Task["rubocop:autocorrect"].invoke
Rake::Task["format_rust"].invoke
end
# Enhance the clean task to also clean Rust artifacts
Rake::Task[:clean].enhance([:clean_rust])
task compile_release: :clean do
ENV["RELEASE"] = "true"
Rake::Task[:compile].invoke
end
task test: [:cargo_test, :ruby_test]
task check: [:lint, :test]
task default: :check