Skip to content

Commit

Permalink
add better warning to prevent direct editing of auto-gen docs
Browse files Browse the repository at this point in the history
  • Loading branch information
seanlinsley committed Oct 23, 2013
1 parent 26ab7a1 commit 2482f0e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
6 changes: 5 additions & 1 deletion docs/3-index-pages/index-as-block.md
@@ -1,4 +1,8 @@
<!-- Please don't edit this file. It will be clobbered. -->
<!--
WARNING: Please DO NOT edit this file! Update
source documentation in lib/active_admin/views
and execute rake yard to regenerate it.
-->

# Index as a Block

Expand Down
6 changes: 5 additions & 1 deletion docs/3-index-pages/index-as-blog.md
@@ -1,4 +1,8 @@
<!-- Please don't edit this file. It will be clobbered. -->
<!--
WARNING: Please DO NOT edit this file! Update
source documentation in lib/active_admin/views
and execute rake yard to regenerate it.
-->

# Index as Blog

Expand Down
6 changes: 5 additions & 1 deletion docs/3-index-pages/index-as-grid.md
@@ -1,4 +1,8 @@
<!-- Please don't edit this file. It will be clobbered. -->
<!--
WARNING: Please DO NOT edit this file! Update
source documentation in lib/active_admin/views
and execute rake yard to regenerate it.
-->

# Index as a Grid

Expand Down
6 changes: 5 additions & 1 deletion docs/3-index-pages/index-as-table.md
@@ -1,4 +1,8 @@
<!-- Please don't edit this file. It will be clobbered. -->
<!--
WARNING: Please DO NOT edit this file! Update
source documentation in lib/active_admin/views
and execute rake yard to regenerate it.
-->

# Index as a Table

Expand Down
13 changes: 9 additions & 4 deletions tasks/docs.rake
@@ -1,8 +1,13 @@
namespace :docs do

def prepare_docstring(content)
"<!-- Please don't edit this file. It will be clobbered. -->\n\n#{content}\n"
end
AUTOGEN_WARNING = <<-EOD
<!--
WARNING: Please DO NOT edit this file! Update
source documentation in lib/active_admin/views
and execute rake yard to regenerate it.
-->
EOD

def filename_from_module(mod)
mod.name.to_s.underscore.gsub('_', '-')
Expand All @@ -11,7 +16,7 @@ namespace :docs do
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)
f << AUTOGEN_WARNING + mod.docstring + "\n"
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion tasks/yard.rake
Expand Up @@ -2,5 +2,6 @@ require 'yard'
require 'yard/rake/yardoc_task'

YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb']
t.after = ->{ Rake::Task['docs:build'].invoke }
t.files = ['lib/**/*.rb']
end

0 comments on commit 2482f0e

Please sign in to comment.