Skip to content

Instantly share code, notes, and snippets.

@rkoster
Created August 11, 2015 09:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkoster/8c179b1904e5ee0d499d to your computer and use it in GitHub Desktop.
Save rkoster/8c179b1904e5ee0d499d to your computer and use it in GitHub Desktop.
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