Class: Danger::PluginReadme
- Inherits:
-
CLAide::Command::Plugins
- Object
- CLAide::Command::Plugins
- Danger::PluginReadme
- Defined in:
- lib/danger/commands/plugins/plugin_readme.rb
Instance Attribute Summary collapse
-
#cork ⇒ Object
Returns the value of attribute cork.
-
#json ⇒ Object
Returns the value of attribute json.
-
#markdown ⇒ Object
Returns the value of attribute markdown.
Instance Method Summary collapse
-
#initialize(argv) ⇒ PluginReadme
constructor
A new instance of PluginReadme.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ PluginReadme
Returns a new instance of PluginReadme.
13 14 15 16 17 18 |
# 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 |
Instance Attribute Details
#cork ⇒ Object
Returns the value of attribute cork.
11 12 13 |
# File 'lib/danger/commands/plugins/plugin_readme.rb', line 11 def cork @cork end |
#json ⇒ Object
Returns the value of attribute json.
11 12 13 |
# File 'lib/danger/commands/plugins/plugin_readme.rb', line 11 def json @json end |
#markdown ⇒ Object
Returns the value of attribute markdown.
31 32 33 |
# File 'lib/danger/commands/plugins/plugin_readme.rb', line 31 def markdown @markdown end |
Instance Method Details
#run ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/danger/commands/plugins/plugin_readme.rb', line 32 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), 0, "-").result(binding) end |