-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRakefile
More file actions
73 lines (55 loc) · 1.71 KB
/
Rakefile
File metadata and controls
73 lines (55 loc) · 1.71 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# frozen_string_literal: true
require "bundler/gem_tasks"
desc "Build Vue.js frontend"
task :frontend do
Dir.chdir("frontend") do
sh "npm ci"
sh "npm run build"
end
end
# Ensure frontend is built before packaging the gem
Rake::Task["build"].enhance([:frontend])
# Override release tasks to skip git operations in CI
if ENV["CI"]
Rake::Task["release:guard_clean"].clear
Rake::Task["release:source_control_push"].clear
end
require "minitest/test_task"
Minitest::TestTask.create do |t|
# Ensure test_helper is loaded first for proper SimpleCov initialization
t.test_prelude = 'require "test_helper"'
end
# Clean coverage folder before running tests to ensure accurate results
desc "Clean coverage folder"
task :clean_coverage do
require "fileutils"
FileUtils.rm_rf("coverage")
end
Rake::Task["test"].enhance([:clean_coverage])
require "rubocop/rake_task"
RuboCop::RakeTask.new
require "steep/rake_task"
Steep::RakeTask.new do |t|
t.check.severity_level = :error
t.watch.verbose
end
task default: %i[test steep rubocop]
require "bundler/audit/task"
Bundler::Audit::Task.new
desc "Update lib/archsight/version.rb from git tag"
task :version do
tag = `git describe --tags --abbrev=0 2>/dev/null`.strip
abort "No valid version tag found (expected v*.*.* format)" unless tag.match?(/^v\d+\.\d+/)
version = tag.delete_prefix("v")
version_file = File.expand_path("lib/archsight/version.rb", __dir__)
content = <<~RUBY
# frozen_string_literal: true
# This file is automatically generated by `rake version` from git tags.
# Do not edit manually.
module Archsight
VERSION = "#{version}"
end
RUBY
File.write(version_file, content)
puts "Updated version.rb to #{version}"
end