dolphins7.skeleton/rake/tasks/rubocop.rake
0x1eef 2e8cf6e333 Drop 'twenty-' prefix from toplevel directories
The directories twenty-{server,client,cli} have been renamed to
not include 'twenty-'. The gems are still published with the twenty-
prefix, otherwise a collision is impossible to avoid. This commit makes
it slightly easier to generalize twenty.
2024-04-21 20:11:25 -03:00

32 lines
797 B
Ruby

#!/usr/bin/env ruby
namespace :rubocop do
root = File.realpath File.join(__dir__, "..", "..")
gems = [
File.join(root, "cli"),
File.join(root, "server"),
File.join(root, "client")
]
desc "Copy '.rubocop.yml' into place"
task :copy do
gems.each do
dest = File.join(_1, ".rubocop.yml")
cp File.join(root, ".rubocop.yml"), dest
warn = "##\n" \
"# DON'T EDIT THIS FILE DIRECTLY.\n" \
"# Edit '.rubocop.yml' at the root of the project instead.\n" \
"##\n\n"
File.write dest, [warn, *File.read(dest).each_line].join
end
end
desc "Apply rubocop rules"
task :apply do
gems.each do
Dir.chdir(_1) do
Bundler.with_unbundled_env { sh "bundle exec rubocop -A" }
end
end
end
end