Sha256: d5feed9586eef44713bc170bd7d4e27898e83ceb1a0c835565d4031f46cc42ff

Contents?: true

Size: 1.31 KB

Versions: 46

Compression:

Stored size: 1.31 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 = registry.all(:class)
        .select { |klass| klass.inheritance_tree.map(&:name).include? :CI }
        .reject { |source| source.name == :CI }
        .reject { |source| source.name == :LocalGitRepo }

      # 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

46 entries across 46 versions & 2 rubygems

Version Path
danger-9.5.1 lib/danger/commands/systems.rb
danger-9.5.0 lib/danger/commands/systems.rb
danger-9.4.3 lib/danger/commands/systems.rb
danger-9.4.2 lib/danger/commands/systems.rb
danger-9.4.1 lib/danger/commands/systems.rb
danger-9.4.0 lib/danger/commands/systems.rb
danger-9.3.2 lib/danger/commands/systems.rb
danger-additional-logging-0.0.36 lib/danger/commands/systems.rb
danger-additional-logging-0.0.35 lib/danger/commands/systems.rb
danger-additional-logging-0.0.34 lib/danger/commands/systems.rb
danger-additional-logging-0.0.33 lib/danger/commands/systems.rb
danger-additional-logging-0.0.32 lib/danger/commands/systems.rb
danger-additional-logging-0.0.31 lib/danger/commands/systems.rb
danger-additional-logging-0.0.30 lib/danger/commands/systems.rb
danger-additional-logging-0.0.29 lib/danger/commands/systems.rb
danger-additional-logging-0.0.28 lib/danger/commands/systems.rb
danger-additional-logging-0.0.27 lib/danger/commands/systems.rb
danger-additional-logging-0.0.26 lib/danger/commands/systems.rb
danger-additional-logging-0.0.25 lib/danger/commands/systems.rb
danger-additional-logging-0.0.24 lib/danger/commands/systems.rb