Sha256: 5f18a04ddbc67e41bbc6905cd1179dd2c2ae200f42e6cb9b86fdc8316ae153a6

Contents?: true

Size: 1.34 KB

Versions: 126

Compression:

Stored size: 1.34 KB

Contents

module Danger
  class Systems < Runner
    self.abstract_command = true
    self.description = "For commands related to passing information from Danger to Danger.Systems."
    self.summary = "Create data for Danger.Systems."
  end

  class CIDocs < Systems
    self.command = "ci_docs"
    self.summary = "Outputs the up-to-date CI documentation for Danger."

    def run
      here = File.dirname(__FILE__)
      ci_source_paths = Dir.glob(here + "/../ci_source/*.rb")

      require "yard"
      # Pull out all the Danger::CI subclasses docs
      registry = YARD::Registry.load(ci_source_paths, true)
      ci_sources = begin
        registry.all(:class)
          .select { |klass| klass.inheritance_tree.map(&:name).include? :CI }
          .reject { |source| source.name == :CI }
          .reject { |source| source.name == :LocalGitRepo }
      end

      # Fail if anything is added and not documented
      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

      # Output a JSON array of name and details
      require "json"
      cork.puts ci_sources.map { |ci|
        {
          name: ci.name,
          docs: ci.docstring
        }
      }.to_json
    end
  end
end

Version data entries

126 entries across 126 versions & 1 rubygems

Version Path
danger-6.0.2 lib/danger/commands/systems.rb
danger-6.0.1 lib/danger/commands/systems.rb
danger-6.0.0 lib/danger/commands/systems.rb
danger-5.16.1 lib/danger/commands/systems.rb
danger-5.16.0 lib/danger/commands/systems.rb
danger-5.15.0 lib/danger/commands/systems.rb
danger-5.14.0 lib/danger/commands/systems.rb
danger-5.13.0 lib/danger/commands/systems.rb
danger-5.12.0 lib/danger/commands/systems.rb
danger-5.11.1 lib/danger/commands/systems.rb
danger-5.11.0 lib/danger/commands/systems.rb
danger-5.10.3 lib/danger/commands/systems.rb
danger-5.10.2 lib/danger/commands/systems.rb
danger-5.10.1 lib/danger/commands/systems.rb
danger-5.10.0 lib/danger/commands/systems.rb
danger-5.9.1 lib/danger/commands/systems.rb
danger-5.9.0 lib/danger/commands/systems.rb
danger-5.8.2 lib/danger/commands/systems.rb
danger-5.8.1 lib/danger/commands/systems.rb
danger-5.8.0 lib/danger/commands/systems.rb