Sha256: 10b8ad1e5c90f15a449dfdc9b042e68efe5a9da4a87bfc4fbaac2738addbd3a2

Contents?: true

Size: 1.4 KB

Versions: 27

Compression:

Stored size: 1.4 KB

Contents

# How to roll your own Doc Generator

1. Create a ConsumerContractRenderer that responds to `call` and accepts a `ConsumerContract` (this is the name for the domain model of a "pact"). This should return a String. For an example, see the [Markdown::ConsumerContractRenderer][consumer_contract_renderer].
2. Create an IndexRenderer. This allows you to create an index file for your docs. It should respond to `call` and accept the String name of the consumer, and a hash of Hash of `pact title => file_name`, and return a String. For an example, see the [Markdown::IndexRenderer][index_renderer].
3. Create a Generator. This is responsible for the overall file generating and writing process. Copy the [Markdown::Generator][generator] and configure it with your own ConsumerContractRenderer, IndexRenderer and file details.

If you would like to generate HTML documentation, see how the [HTMLPactRenderer][html_pact_renderer] in the Pact Broker does it.

[consumer_contract_renderer]: https://github.com/realestate-com-au/pact/blob/master/lib/pact/doc/markdown/consumer_contract_renderer.rb
[index_renderer]: https://github.com/realestate-com-au/pact/blob/master/lib/pact/doc/markdown/index_renderer.rb
[generator]: https://github.com/realestate-com-au/pact/blob/master/lib/pact/doc/markdown/generator.rb
[html_pact_renderer]: https://github.com/bethesque/pact_broker/blob/master/lib/pact_broker/api/renderers/html_pact_renderer.rb

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
pact-1.20.0 lib/pact/doc/README.md
pact-1.19.2 lib/pact/doc/README.md
pact-1.19.1 lib/pact/doc/README.md
pact-1.19.0 lib/pact/doc/README.md
pact-1.18.0 lib/pact/doc/README.md
pact-1.17.0 lib/pact/doc/README.md
pact-1.16.1 lib/pact/doc/README.md
pact-1.16.0 lib/pact/doc/README.md
pact-1.15.0 lib/pact/doc/README.md
pact-1.14.0 lib/pact/doc/README.md
pact-1.13.0 lib/pact/doc/README.md
pact-1.12.1 lib/pact/doc/README.md
pact-1.12.0 lib/pact/doc/README.md
pact-1.11.1 lib/pact/doc/README.md
pact-1.11.0 lib/pact/doc/README.md
pact-1.10.0 lib/pact/doc/README.md
pact-1.9.6 lib/pact/doc/README.md
pact-1.9.5 lib/pact/doc/README.md
pact-1.9.4 lib/pact/doc/README.md
pact-1.9.3 lib/pact/doc/README.md