Skip to content
Snippets Groups Projects

WIP: Flatten further

Closed Mark Pundsack requested to merge flatten-further into master
1 file
+ 10
3
Compare changes
  • Side-by-side
  • Inline
+ 10
3
@@ -6,7 +6,13 @@ uri = URI.parse 'https://gitlab.com/api/v3/ci/lint'
Dir.glob("#{File.dirname(__FILE__)}/**/*.yml").each do |file|
response = Net::HTTP.post_form(uri, content: File.read(file))
file = file.match(/((\w|\+|#)+)\.gitlab-ci/)[1]
match = file.match(/(?<file>(\w|\+|#)+)\.gitlab-ci.yml/)
template_name = match ? match[:file] : nil
unless template_name
puts "Invalid file format for #{file}"
exit(1)
end
if JSON.parse(response.body)['status'] == 'valid'
puts "\e[32mvalid\e[0m: #{file}" # Color 'valid' green
@@ -17,5 +23,6 @@ Dir.glob("#{File.dirname(__FILE__)}/**/*.yml").each do |file|
end
# Given we test all the templates, the coverage is 100%, always. To showcase
# how this is done, we print it here.
puts "Coverage: 100%"
\ No newline at end of file
# how this is done, we print it here. The regex to parse this would be:
# /Coverage:\s(d+)%/
puts "Coverage: 100%"
Loading