Skip to content

Instantly share code, notes, and snippets.

@burtlo
Created April 25, 2011 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burtlo/940246 to your computer and use it in GitHub Desktop.
Save burtlo/940246 to your computer and use it in GitHub Desktop.
yardoc issue 300 workaround
# Parses commandline arguments
# @param [Array<String>] args the list of arguments
# @return [Boolean] whether or not arguments are valid
# @since 0.5.6
def parse_arguments(*args)
options[:markup] = nil # reset markup
# Hack: parse out --no-yardopts, --no-document before parsing files
['document', 'yardopts'].each do |file|
without, with = args.index("--no-#{file}") || -2, args.index("--#{file}") || -1
send("use_#{file}_file=", false) if without > with
end
# Parse files and then command line arguments
optparse(*support_rdoc_document_file!) if use_document_file
optparse(*yardopts) if use_yardopts_file
optparse(*args)
# Last minute modifications
self.files = ['lib/**/*.rb', 'ext/**/*.c'] if self.files.empty?
self.files.delete_if {|x| x =~ /\A\s*\Z/ } # remove empty ones
options[:readme] ||= Dir.glob('README*').first
if options[:onefile]
options[:files] << options[:readme] if options[:readme]
options[:readme] = Dir.glob(files.first).first
end
Tags::Library.visible_tags -= hidden_tags
add_visibility_verifier
verified_markup_result = verify_markup_options
if generate && !verified_markup_result
false
else
true
end
end
@burtlo
Copy link
Author

burtlo commented Apr 25, 2011

Line 30 will store the result of the verify_markup_options and then use that in the comparison below, instead of failing fast when the generate option returns false (when the -n option is used).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment