def run
here = File.dirname(__FILE__)
ci_source_paths = Dir.glob(here + "/../ci_source/*.rb")
require "yard"
registry = YARD::Registry.load(ci_source_paths, true)
ci_sources = registry.all(:class)
.select { |klass| klass.inheritance_tree.map(&:name).include? :CI }
.reject { |source| source.name == :CI }
.reject { |source| source.name == :LocalGitRepo }
cis_without_docs = ci_sources.select { |source| source.base_docstring.empty? }
unless cis_without_docs.empty?
cork.puts "Please add docs to: #{cis_without_docs.map(&:name).join(', ')}"
abort("Failed.".red)
end
require "json"
cork.puts ci_sources.map { |ci|
{
name: ci.name,
docs: ci.docstring
}
}.to_json
end