class Danger::PluginReadme

Attributes

cork[RW]
json[RW]
markdown[RW]

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/danger/commands/plugins/plugin_readme.rb, line 13
def initialize(argv)
  @refs = argv.arguments! unless argv.arguments.empty?
  @cork = Cork::Board.new(silent: argv.option("silent", false),
                          verbose: argv.option("verbose", false))
  super
end

Public Instance Methods

run() click to toggle source
# File lib/danger/commands/plugins/plugin_readme.rb, line 29
def run
  file_resolver = PluginFileResolver.new(@refs)
  data = file_resolver.resolve

  parser = PluginParser.new(data[:paths])
  parser.parse

  self.json = JSON.parse(parser.to_json_string)

  template = File.join(Danger.gem_path, "lib/danger/plugin_support/templates/readme_table.html.erb")
  cork.puts ERB.new(File.read(template), trim_mode: "-").result(binding)
end