Class: Danger::PluginJSON

Inherits:
CLAide::Command::Plugins
  • Object
show all
Defined in:
lib/danger/commands/plugins/plugin_json.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ PluginJSON

Returns a new instance of PluginJSON.



11
12
13
14
15
16
# File 'lib/danger/commands/plugins/plugin_json.rb', line 11

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

#corkObject

Returns the value of attribute cork.



9
10
11
# File 'lib/danger/commands/plugins/plugin_json.rb', line 9

def cork
  @cork
end

Instance Method Details

#runObject



30
31
32
33
34
35
36
37
38
# File 'lib/danger/commands/plugins/plugin_json.rb', line 30

def run
  file_resolver = PluginFileResolver.new(@refs)
  paths = file_resolver.resolve_to_paths

  parser = PluginParser.new(paths)
  parser.parse
  json = parser.to_json_string
  cork.puts json
end