Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 40 lines (31 sloc) 0.924 kB
97f2f90 @gregbell Added a rake task to generate docs/ from class documentation.
gregbell authored
1 namespace :docs do
2
3 def rdoc_to_markdown(content)
4 content.gsub(/^ ?(=+) /) do |m|
5 m.gsub('=', '#')
6 end
7 end
8
9 def prepare_docstring(content)
10 content = rdoc_to_markdown(content)
11 "<!-- Please don't edit this file. It will be clobbered. -->\n\n#{content}"
12 end
13
14 def filename_from_module(mod)
15 mod.name.to_s.underscore.gsub('_', '-')
16 end
17
18 def write_docstrings_to(path, mods)
19 mods.each do |mod|
20 File.open("#{path}/#{filename_from_module(mod)}.md", 'w+') do |f|
21 f << prepare_docstring(mod.docstring)
22 end
23 end
24 end
25
26 desc "Update docs in the docs folder"
27 task :build do
28 require 'yard'
29 require 'active_support/all'
30
31 YARD::Registry.load!
32 views = YARD::Registry.at("ActiveAdmin::Views")
33
34 # Index Types
35 index_types = views.children.select{|obj| obj.name.to_s =~ /^IndexAs/ }
36 write_docstrings_to "docs/3-index-pages", index_types
37 end
38
39 end
Something went wrong with that request. Please try again.