Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
activeadmin / tasks / docs.rake
Size: Mime:
namespace :docs do

  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.tr('_', '-')
  end

  def write_docstrings_to(path, mods)
    mods.each do |mod|
      File.open("#{path}/#{filename_from_module(mod)}.md", 'w+') do |f|
        f << AUTOGEN_WARNING + mod.docstring + "\n"
      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