Sha256: 7612bf772ae37f925fa11113748155af6844985036e9a36fc72c2db2d08458a2
Contents?: true
Size: 924 Bytes
Versions: 73
Compression:
Stored size: 924 Bytes
Contents
namespace :docs do def rdoc_to_markdown(content) content.gsub(/^ ?(=+) /) do |m| m.gsub('=', '#') end end def prepare_docstring(content) content = rdoc_to_markdown(content) "<!-- Please don't edit this file. It will be clobbered. -->\n\n#{content}" end def filename_from_module(mod) mod.name.to_s.underscore.gsub('_', '-') end def write_docstrings_to(path, mods) mods.each do |mod| File.open("#{path}/#{filename_from_module(mod)}.md", 'w+') do |f| f << prepare_docstring(mod.docstring) end end end desc "Update docs in the docs folder" task :build do require 'yard' require 'active_support/all' YARD::Registry.load! views = YARD::Registry.at("ActiveAdmin::Views") # Index Types index_types = views.children.select{|obj| obj.name.to_s =~ /^IndexAs/ } write_docstrings_to "docs/3-index-pages", index_types end end
Version data entries
73 entries across 73 versions & 5 rubygems