class GemOf::DocsTasks
various yarddoc docs tasks
arch, clean, measure, undoc, verify, yard
Constants
- DOCS_DIR
location of the human user docs (markdown, etc)
- YARD_DIR
location of the yarddocs produced
Public Class Methods
new()
click to toggle source
instance yardoc tasks in namespace :docs @api public @example DocsTasks.new
# File lib/gem_of/rake_tasks.rb, line 82 def initialize namespace :docs do # docs:yard task YARD::Rake::YardocTask.new desc "Clean/remove the generated YARD Documentation cache" task :clean do sh "rm -rf #{YARD_DIR}" end desc "Tell me about YARD undocumented objects" YARD::Rake::YardocTask.new(:undoc) do |t| t.stats_options = ["--list-undoc"] end desc "Generate static project architecture graph. (Calls docs:yard)" # this calls `yard graph` so we can't use the yardoc tasks like above # We could create a YARD:CLI:Graph object. # But we have to send the output to the graphviz processor, etc. task arch: [:yard] do arch_diagram end end end
Private Instance Methods
arch_diagram()
click to toggle source
@private
# File lib/gem_of/rake_tasks.rb, line 110 def arch_diagram original_dir = Dir.pwd # this won't work all the time, and when it doesn't, # it still says we created a class diagram # FIXME: use Rake.application.original_dir # Dir.chdir(File.expand_path(File.dirname(__FILE__))) graph_processor = "dot" if exe_exists?(graph_processor) FileUtils.mkdir_p(DOCS_DIR) if system("yard graph --full | #{graph_processor} -Tpng " \ "-o #{DOCS_DIR}/arch_graph.png") puts "we made you a class diagram: #{DOCS_DIR}/arch_graph.png" end else puts "ERROR: you don't have dot/graphviz; punting" end Dir.chdir(original_dir) end
exe_exists?(name)
click to toggle source
Cross-platform exe_exists? @private
# File lib/gem_of/rake_tasks.rb, line 131 def exe_exists?(name) exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""] ENV["PATH"].split(File::PATH_SEPARATOR).each do |path| exts.each do |ext| exe = File.join(path, "#{name}#{ext}") return true if File.executable?(exe) && !File.directory?(exe) end end false end