|
3 | 3 |
|
4 | 4 | SOURCE_REPO = 'pact-foundation/pact-reference' |
5 | 5 | DESTINATION_DIR = relative_path_to('docs/implementation_guides/rust') |
| 6 | +CLI_DESTINATION_DIR = relative_path_to('docs/implementation_guides/cli') |
6 | 7 | TRANSFORM_PATH = -> (path) { |
7 | 8 | if path == 'rust/README.md' |
8 | 9 | "#{DESTINATION_DIR}.md" |
| 10 | + elsif path == "rust/pact_verifier_cli/README.md" |
| 11 | + "#{CLI_DESTINATION_DIR}/pact-verifier.md" |
| 12 | + elsif path == "rust/pact_verifier_cli/CHANGELOG.md" |
| 13 | + "#{CLI_DESTINATION_DIR}/pact-verifier/changelog.md" |
9 | 14 | else |
10 | 15 | File.join(DESTINATION_DIR, path.downcase.delete_prefix('rust/').gsub('/readme.md', '.md')) |
11 | 16 | end |
12 | 17 | } |
13 | 18 | INCLUDE = [ |
14 | | - # ->(path) { path.end_with?('pact_mock_server_cli/README.md') } |
15 | 19 | ->(path) { path.start_with?('rust') && path.end_with?('.md') } |
16 | 20 | ] |
17 | | -IGNORE = [] |
| 21 | +IGNORE = [ |
| 22 | +->(path) { path == 'rust/pact_mock_server/README.md' }, |
| 23 | +->(path) { path == 'rust/pact_mock_server/CHANGELOG.md' }, |
| 24 | +->(path) { path == 'rust/pact_mock_server_cli/README.md' }, |
| 25 | +->(path) { path == 'rust/pact_mock_server_cli/CHANGELOG.md' } |
| 26 | +] |
18 | 27 | CUSTOM_ACTIONS = [ |
19 | 28 | [->(path) { !path.end_with?('CHANGELOG.md') }, ->(md_file_contents) { md_file_contents.extract_title } ], |
20 | 29 | [->(path) { path.end_with?('CHANGELOG.md') }, ->(md_file_contents) { |
|
23 | 32 | md_file_contents.find_and_replace(/^# /, '## ') |
24 | 33 | }], |
25 | 34 | ["rust/README.md", ->(md_file_contents) { md_file_contents.fields[:title] = "Overview" } ], |
26 | | - ["rust/pact_ffi/README.md", ->(md_file_contents) { md_file_contents.find_and_replace(%r{</details>}, '</details>') }], |
| 35 | + ["rust/pact_ffi/README.md", ->(md_file_contents) { |
| 36 | + md_file_contents.find_and_replace(%r{</details>}, '</details>') |
| 37 | + md_file_contents.fields[:title] = "README" |
| 38 | + }], |
| 39 | + ["rust/pact_verifier_cli/README.md", ->(md_file_contents) { md_file_contents.fields[:title] = "Pact Verifier" } ], |
| 40 | + [->(path) { path.include?('cli') }, lambda { |md_file_contents| |
| 41 | + md_file_contents.add_lines_at_start("## Source Code\n\nhttps://github.com/#{SOURCE_REPO}/tree/master/rust/pact_verifier_cli\n") |
| 42 | + }], |
| 43 | + [->(path) { path.include?('rust/pact_verifier/') }, lambda { |md_file_contents| |
| 44 | + md_file_contents.add_lines_at_start("## Source Code\n\nhttps://github.com/#{SOURCE_REPO}/tree/master/rust/pact_verifier\n") |
| 45 | + }], |
| 46 | + [->(path) { path.include?('rust/pact_consumer/') }, lambda { |md_file_contents| |
| 47 | + md_file_contents.add_lines_at_start("## Source Code\n\nhttps://github.com/#{SOURCE_REPO}/tree/master/rust/pact_consumer\n") |
| 48 | + }], |
| 49 | + [->(path) { path.include?('rust/pact_models/') }, lambda { |md_file_contents| |
| 50 | + md_file_contents.add_lines_at_start("## Source Code\n\nhttps://github.com/#{SOURCE_REPO}/tree/master/rust/pact_models\n") |
| 51 | + }], |
| 52 | + [->(path) { path.include?('rust/pact_matching/') }, lambda { |md_file_contents| |
| 53 | + md_file_contents.add_lines_at_start("## Source Code\n\nhttps://github.com/#{SOURCE_REPO}/tree/master/rust/pact_matching\n") |
| 54 | + }], |
| 55 | + [->(path) { path.include?('rust/pact_ffi/') }, lambda { |md_file_contents| |
| 56 | + md_file_contents.add_lines_at_start("## Source Code\n\nhttps://github.com/#{SOURCE_REPO}/tree/master/rust/pact_ffi\n") |
| 57 | + }], |
| 58 | + [->(path) { path.include?('rust/readme.md') }, lambda { |md_file_contents| |
| 59 | + md_file_contents.add_lines_at_start("## Source Code\n\nhttps://github.com/#{SOURCE_REPO}/tree/master/rust\n") |
| 60 | + }], |
27 | 61 | [:all, ->(md_file_contents) { md_file_contents.escape_things_that_look_like_jsx_tags }] |
28 | 62 | ] |
29 | 63 |
|
|
0 commit comments