Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A script for displaying the job dependencies of the cf-relase in a markdown table.
#! /usr/bin/env ruby
# coding: utf-8
require 'yaml'
jobs = Dir['jobs/*'].map { |j| File.basename(j) }
print "∑ | Job | Property | Description\n --- | --- | --- | ---\n"
jobs.map! do |job|
spec = YAML.load_file(File.join("jobs", job, "spec"))
properties = spec['properties'].select do |k, v|
true if k =~ /\.machines|\.url|\.address/
end
[job, properties]
end
jobs.sort! do |x, y|
x[1].length <=> y[1].length
end
def job_link(job)
"[#{job}](https://github.com/cloudfoundry/cf-release/blob/master/jobs/#{job}/spec)"
end
jobs.to_h.each do |job, properties|
if (properties.length == 0)
puts "0 | #{job_link(job)} | | "
else
first = true
properties.each do |k, v|
print first ? "#{properties.length} | #{job_link(job)}" : "| #{job}"
print " | #{k} | #{v['description']}\n"
first = false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.