Sha256: bcab380344f6aa47f6c79a37eb26ac210fc2e3a6dd70658fd28c0652ee4d8646

Contents?: true

Size: 1.47 KB

Versions: 3

Compression:

Stored size: 1.47 KB

Contents

require 'handlebars'
require "rapidoc/config"
require "rapidoc/version"
require "tasks/railtie.rb"
require "rapidoc/routes_doc"
require "rapidoc/resource_doc"
require "rapidoc/action_doc"
require "rapidoc/controller_extractor"
require "rapidoc/resources_extractor"
require "rapidoc/param_errors"
require "rapidoc/templates_generator"
require "rapidoc/yaml_parser"

module Rapidoc

  include Config
  include ResourcesExtractor
  include TemplatesGenerator
  include ParamErrors
  include YamlParser

  METHODS = [ "GET", "PUT", "DELETE", "POST" ]

  def create_structure
    # should be done in this order
    FileUtils.mkdir target_dir unless File.directory? target_dir
    FileUtils.mkdir actions_dir unless File.directory? actions_dir
    FileUtils.cp_r GEM_CONFIG_DIR + "/.", config_dir unless File.directory? config_dir
    FileUtils.cp_r GEM_ASSETS_DIR, target_dir
    FileUtils.mkdir examples_dir unless File.directory? examples_dir
  end

  def remove_structure
    remove_doc
    remove_config
  end

  def remove_config
    FileUtils.rm_r config_dir if File.directory? config_dir
  end

  def remove_doc
    FileUtils.rm_r target_dir if File.directory? target_dir
  end

  def reset_structure
    remove_structure
    create_structure
  end

  def remove_examples
    FileUtils.rm_r examples_dir if File.directory? examples_dir
  end

  def generate_doc
    resources_doc = get_resources

    generate_index_template( resources_doc )
    generate_actions_templates( resources_doc )
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rapidoc-0.0.6 lib/rapidoc.rb
rapidoc-0.0.5 lib/rapidoc.rb
rapidoc-0.0.4 lib/rapidoc.rb