debian-mirror-gitlab/lib/tasks/config_lint.rake

28 lines
559 B
Ruby
Raw Normal View History

2021-03-11 19:13:27 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
module ConfigLint
def self.run(files)
failures = files.reject do |file|
yield(file)
end
if failures.present?
puts failures
exit failures.count
end
end
end
desc "Checks syntax for shell scripts and nginx config files in 'lib/support/'"
task :config_lint do
shell_scripts = [
'lib/support/init.d/gitlab',
'lib/support/init.d/gitlab.default.example',
'lib/support/deploy/deploy.sh'
]
ConfigLint.run(shell_scripts) do |file|
Kernel.system('bash', '-n', file)
end
end