Method: YARD::CLI::Yardoc#run

Defined in:
lib/yard/cli/yardoc.rb

#run(*args) ⇒ void

This method returns an undefined value.

Runs the commandline utility, parsing arguments and generating output if set.

Parameters:

Since:

  • 0.2.1



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/yard/cli/yardoc.rb', line 244

def run(*args)
  log.show_progress = true
  if args.empty? || !args.first.nil?
    # fail early if arguments are not valid
    return unless parse_arguments(*args)
  end

  checksums = nil
  if use_cache
    Registry.load
    checksums = Registry.checksums.dup
  end

  if save_yardoc
    Registry.lock_for_writing do
      YARD.parse(files, excluded)
      Registry.save(use_cache)
    end
  else
    YARD.parse(files, excluded)
  end

  if generate
    run_generate(checksums)
    copy_assets
  elsif list
    print_list
  end

  if !list && statistics && log.level < Logger::ERROR
    Registry.load_all
    log.enter_level(Logger::ERROR) do
      Stats.new(false).run(*args)
    end
  end

  abort if fail_on_warning && log.warned

  true
ensure
  log.show_progress = false
end