-
Notifications
You must be signed in to change notification settings - Fork 117
Expand file tree
/
Copy pathRakefile
More file actions
50 lines (41 loc) · 1.13 KB
/
Rakefile
File metadata and controls
50 lines (41 loc) · 1.13 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
# frozen_string_literal: true
require "bundler"
Bundler::GemHelper.install_tasks
require "rake/testtask"
Rake::TestTask.new(:test) do |test|
test.libs << "lib" << "test"
test.pattern = "test/**/test_*.rb"
test.verbose = true
end
begin
require "rubocop/rake_task"
RuboCop::RakeTask.new
rescue LoadError
task :rubocop do
warn "Rubocop is disabled"
end
end
desc "Run mutation tests"
task :mutant do
sh "bundle exec mutant run"
end
task default: %i[test rubocop mutant]
namespace :assets do
desc "Compiles all assets using esbuild"
task :compile do
puts "Compiling assets"
# JS: esbuild bundles TypeScript + highlight.js and minifies
sh "esbuild src/app.ts --bundle --minify --target=es2015 --outfile=public/application.js"
# CSS: concatenate in order and minify
css = %w[
assets/stylesheets/reset.css
assets/stylesheets/plugins/highlight.css
assets/stylesheets/screen.css
].map { |f| File.read(f) }.join("\n")
IO.popen(%w[esbuild --minify --loader=css], "r+") do |io|
io.write(css)
io.close_write
File.write("public/application.css", io.read)
end
end
end