lib/danger/plugin_support/plugin_parser.rb in danger-0.9.1 vs lib/danger/plugin_support/plugin_parser.rb in danger-0.10.0
- old
+ new
@@ -32,26 +32,36 @@
module Danger
class PluginParser
attr_accessor :registry
- def initialize(paths)
+ def initialize(paths, verbose = false)
raise "Path cannot be empty" if paths.empty?
+ setup_yard(verbose)
+
if paths.kind_of? String
@paths = [File.expand_path(paths)]
else
@paths = paths
end
end
- def parse
+ def setup_yard(verbose)
require 'yard'
- # could this go in a singleton-y place instead?
- # like class initialize?
+
+ # Unless specifically asked, don't output anything.
+ unless verbose
+ YARD::Logger.instance.level = YARD::Logger::FATAL
+ end
+
+ # Add some of our custom tags
YARD::Tags::Library.define_tag('tags', :tags)
YARD::Tags::Library.define_tag('availablity', :availablity)
+ end
+
+ def parse
files = ["lib/danger/plugin_support/plugin.rb"] + @paths
# This turns on YARD debugging
# $DEBUG = true
@@ -151,10 +161,10 @@
require klass.file
real_klass = Danger.const_get klass.name
attribute_meths = klass.attributes[:instance].values.map(&:values).flatten
methods = klass.meths - klass.inherited_meths - attribute_meths
- usable_methods = methods.select { |m| m.visibility == :public }.reject { |m| m.name == :initialize || m.name == :insance_name }
+ usable_methods = methods.select { |m| m.visibility == :public }.reject { |m| m.name == :initialize || m.name == :instance_name }
{
name: klass.name.to_s,
body_md: klass.docstring,
instance_name: real_klass.instance_name,