class SP::Duh::JSONAPI::Doc::Generator

Public Class Methods

new(pg_connection) click to toggle source
# File lib/sp/duh/jsonapi/doc/generator.rb, line 11
def initialize(pg_connection)
  @pg_connection = pg_connection
end

Public Instance Methods

generate(resource_publisher, version, doc_folder_path = File.join(Dir.pwd, 'apidoc')) click to toggle source
# File lib/sp/duh/jsonapi/doc/generator.rb, line 15
def generate(resource_publisher, version, doc_folder_path = File.join(Dir.pwd, 'apidoc'))
  # Load the JSONAPI resources from the given publishers
  @parser = SP::Duh::JSONAPI::Doc::VictorPinusMetadataFormatParser.new(@pg_connection)
  @parser.parse(resource_publisher)
  # Generate the resources documentation
  @generator = SP::Duh::JSONAPI::Doc::ApidocDocumentationFormatGenerator.new
  @generator.generate(@parser, version, doc_folder_path)
  # Regenerate the documentation site
  _log "Generating the documentation site in #{doc_folder_path}", "JSONAPI::Doc::Generator"
  `(cd #{doc_folder_path} && apidoc)`
end