Sha256: d9c450d6f6ef0aab296c700c925741f52884f9b45b6485bd7c1d746a164a3c8d

Contents?: true

Size: 1.41 KB

Versions: 75

Compression:

Stored size: 1.41 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/pact-foundation/pact-ruby/blob/master/lib/pact/doc/markdown/consumer_contract_renderer.rb
[index_renderer]: https://github.com/pact-foundation/pact-ruby/blob/master/lib/pact/doc/markdown/index_renderer.rb
[generator]: https://github.com/pact-foundation/pact-ruby/blob/master/lib/pact/doc/markdown/generator.rb
[html_pact_renderer]: https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/api/renderers/html_pact_renderer.rb

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
pact-1.66.1 lib/pact/doc/README.md
pact-1.66.0 lib/pact/doc/README.md
pact-1.65.3 lib/pact/doc/README.md
pact-1.65.2 lib/pact/doc/README.md
pact-1.65.1 lib/pact/doc/README.md
pact-1.65.0 lib/pact/doc/README.md
pact-1.64.0 lib/pact/doc/README.md
pact-1.63.0 lib/pact/doc/README.md
pact-1.62.0 lib/pact/doc/README.md
pact-1.61.0 lib/pact/doc/README.md
pact-1.60.0 lib/pact/doc/README.md
pact-1.59.0 lib/pact/doc/README.md
pact-1.58.0 lib/pact/doc/README.md
pact-1.57.0 lib/pact/doc/README.md
pact-1.56.0 lib/pact/doc/README.md
pact-1.55.7 lib/pact/doc/README.md
pact-1.55.6 lib/pact/doc/README.md
pact-1.55.5 lib/pact/doc/README.md
pact-1.55.4 lib/pact/doc/README.md
pact-1.55.3 lib/pact/doc/README.md