class GemHadar
def yard_task
def yard_task defined? YARD or return namespace :yard do my_yard_dir = Pathname.new(yard_dir) desc 'Create yard documentation (including private)' task :private do sh "yardoc -o #{my_yard_dir}" end desc 'View the yard documentation' task :view do index_file = my_yard_dir + 'index.html' File.exist?(index_file) sh "open #{index_file}" end desc 'Clean the yard documentation' task :clean do rm_rf my_yard_dir end desc 'List all undocumented classes/modules/methods' task :'list-undoc' do sh "yard stats --list-undoc" end end desc 'Create the yard documentation and view it' task :yard => %i[ yard:private yard:view ] end