-
Notifications
You must be signed in to change notification settings - Fork 104
/
Copy pathpact_jvm.rb
executable file
·37 lines (35 loc) · 1.66 KB
/
pact_jvm.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env ruby
require_relative 'support'
SOURCE_REPO = 'pact-foundation/pact-jvm'
DESTINATION_DIR = relative_path_to('docs/implementation_guides/jvm')
TRANSFORM_PATH = -> (path) {
# Rename README.md file, but not the top level README
File.join(DESTINATION_DIR, path.downcase.gsub('/readme.md', '.md'))
}
INCLUDE = [
->(path) { path.end_with?('.md') }
]
IGNORE = [
->(path) { path.include?('tests_suits') },
->(path) { path.start_with?('core/', '.github/', 'pact-publish/', 'pact-specification-test/', 'provider/scalasupport/', 'ReleaseProcess.md') }
]
CUSTOM_ACTIONS = [
[->(path) { path != 'CHANGELOG.md'}, ->(md_file_contents) { md_file_contents.extract_title } ],
["README.md", ->(md_file_contents) { md_file_contents.fields[:title] = "README"; md_file_contents.fields[:slug] = "./readme" } ],
["CHANGELOG.md", -> (md_file_contents) {
md_file_contents.fields[:title] = "Changelog"
md_file_contents.remove_lines_including('To generate the log')
md_file_contents.remove_lines_including('- chore: ')
md_file_contents.remove_lines_including('- docs: ')
md_file_contents.remove_lines_including('- doc: ')
md_file_contents.remove_lines_including('- refactor: ')
md_file_contents.remove_lines_including('- style: ')
md_file_contents.remove_lines_including(' - Update ')
md_file_contents.remove_lines_including(' - Revert "')
md_file_contents.remove_lines_including(' - Merge branch ')
md_file_contents.remove_lines_including(' - Merge pull request ')
md_file_contents.remove_lines_including(' - bump version ')
md_file_contents.find_and_replace(/^# /, '## ')
}]
]
sync(SOURCE_REPO, INCLUDE, IGNORE, TRANSFORM_PATH, CUSTOM_ACTIONS)