{"id":13878523,"url":"https://github.com/r7kamura/autodoc","last_synced_at":"2025-05-14T08:09:51.175Z","repository":{"id":626586,"uuid":"10545480","full_name":"r7kamura/autodoc","owner":"r7kamura","description":"Generate documentation from your rack application \u0026 request-spec.","archived":false,"fork":false,"pushed_at":"2025-05-09T06:30:23.000Z","size":263,"stargazers_count":380,"open_issues_count":0,"forks_count":62,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-09T07:36:37.788Z","etag":null,"topics":["rspec"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r7kamura.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"r7kamura"}},"created_at":"2013-06-07T08:19:57.000Z","updated_at":"2025-05-09T06:30:26.000Z","dependencies_parsed_at":"2023-02-10T19:31:32.107Z","dependency_job_id":"f99e2c1a-960e-4548-9bf7-da05ddf6c345","html_url":"https://github.com/r7kamura/autodoc","commit_stats":{"total_commits":238,"total_committers":28,"mean_commits":8.5,"dds":0.6050420168067228,"last_synced_commit":"5a4ddc240edd8fae4eaded086a652b4e2643b940"},"previous_names":[],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r7kamura%2Fautodoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r7kamura%2Fautodoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r7kamura%2Fautodoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r7kamura%2Fautodoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r7kamura","download_url":"https://codeload.github.com/r7kamura/autodoc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101559,"owners_count":22014908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rspec"],"created_at":"2024-08-06T08:01:52.078Z","updated_at":"2025-05-14T08:09:46.168Z","avatar_url":"https://github.com/r7kamura.png","language":"Ruby","readme":"# Autodoc\n\n[![test](https://github.com/r7kamura/autodoc/actions/workflows/test.yml/badge.svg)](https://github.com/r7kamura/autodoc/actions/workflows/test.yml)\n[![Gem Version](https://badge.fury.io/rb/autodoc.svg)](https://rubygems.org/gems/autodoc)\n\nGenerate documentation from your rack application \u0026 request-spec.\n\n## Installation\n```ruby\ngem \"autodoc\", group: :test\n```\n\nIf you want to generate toc_html, you should install [redcarpet gem](https://github.com/vmg/redcarpet) (optional).\n\n```ruby\ngem \"redcarpet\", group: :test\n```\n\n## Usage\nRun rspec with AUTODOC=1 to generate documents for your request-specs tagged with `:autodoc`.\nexample: Autodoc generates [doc/recipes.md](https://github.com/r7kamura/autodoc/blob/master/spec/dummy/doc/recipes.md) and [doc/toc.md](https://github.com/r7kamura/autodoc/blob/master/spec/dummy/doc/toc.md) from [spec/requests/recipes_spec.rb](https://github.com/r7kamura/autodoc/blob/master/spec/requests/recipes_spec.rb).\n\n```sh\n# shell-command\nAUTODOC=1 rspec\n```\n\n### Examples\n#### For any Rack application with rack-test\n```ruby\n# spec/requests/entries_spec.rb\ndescribe \"Entries\" do\n  include Rack::Test::Methods\n\n  let(:app) do\n    MyRackApplication\n  end\n\n  describe \"GET /entries\", autodoc: true do\n    it \"returns entries\" do\n      get \"/entries\"\n      last_response.status.should == 200\n    end\n  end\nend\n```\n\n#### For Rails application with rspec-rails\n```ruby\n# spec/requests/recipes_spec.rb\ndescribe \"Recipes\" do\n  describe \"POST /recipes\", autodoc: true do\n    it \"creates a new recipe\" do\n      post \"/recipes\", name: \"alice\", type: 1\n      response.status.should == 201\n    end\n  end\nend\n```\n\n### Custom description\nYou can write more detailed descriptions with `let(:description)`.\n\n```ruby\ndescribe \"Recipes\" do\n  describe \"PUT /recipes/:id\", autodoc: true do\n    let(:description) do\n      \"Updates a recipe. `name` parameter is required.\"\n    end\n\n    it \"updates a recipe\" do\n      put \"/recipes/#{recipe.id}\", name: \"Bob\"\n      response.status.should == 204\n    end\n  end\nend\n```\n\n### Configuration\nYou can configure `Autodoc.configuration` to change its behavior:\n\n* path - [String] location to put files (default: ./doc)\n* suppressed_request_header - [Strings] filtered request header keys\n* suppressed_response_header - [Strings] filtered response header keys\n* template - [String] ERB template for each document (default: [document.md.erb](https://github.com/r7kamura/autodoc/blob/master/lib/autodoc/templates/document.md.erb))\n* toc_template - [String] ERB template for ToC (default: [toc.md.erb](https://github.com/r7kamura/autodoc/blob/master/lib/autodoc/templates/toc.md.erb))\n* toc - [Boolean] whether to generate toc.md (default: false)\n* toc_html_template - [String] ERB template for html ToC (default: [toc.html.erb](https://github.com/r7kamura/autodoc/blob/master/lib/autodoc/templates/toc.html.erb))\n* toc_html - [Boolean] whether to generate toc.html - a single page documentation with a toc (default: false)\n* document_path_from_example - [Proc] specify a Proc to change the naming rule of document file paths\n\n```ruby\nAutodoc.configuration.path = \"doc/api\"\nAutodoc.configuration.toc = true\nAutodoc.configuration.toc_html = true\nAutodoc.configuration.template = File.read(File.expand_path(\"../autodoc/templates/document.md.erb\", __FILE__))\nAutodoc.configuration.document_path_from_example = -\u003e (example) do\n  example.file_path.gsub(%r\u003c\\./spec/requests/api/(.+)_spec\\.rb\u003e, '\\1.md')\nend\n```\n\n## WeakParameters integration\nIf your app uses [WeakParameters](https://github.com/r7kamura/weak_parameters) to define parameters schema\nin your controller, autodoc scans them and provides `### Parameters` section to generated docs.\n\n```rb\nclass RecipesController \u003c ApplicationController\n  validates :create do\n    string :name, required: true, except: [\"charlie\", \"dave\"]\n    integer :type, only: 1..3\n  end\n```\n","funding_links":["https://github.com/sponsors/r7kamura"],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr7kamura%2Fautodoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr7kamura%2Fautodoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr7kamura%2Fautodoc/lists"}