diff --git a/script/docs/generate-configuration-docs.rb b/script/docs/generate-configuration-docs.rb
index a867f26e5..a1688f3b0 100755
--- a/script/docs/generate-configuration-docs.rb
+++ b/script/docs/generate-configuration-docs.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
-require 'yaml'
+require "yaml"
$stream = StringIO.new
@@ -10,7 +10,7 @@ def write string
def escape_backticks value
if value.is_a?(String)
- value.gsub('`', '``')
+ value.gsub("`", "``")
else
value
end
@@ -24,14 +24,14 @@ def in_backticks value
end
end
-docs_dir = File.expand_path('../../../docs', __FILE__)
-environment_variable_file = File.join(docs_dir, 'configuration.yml')
+docs_dir = File.expand_path("../../../docs", __FILE__)
+environment_variable_file = File.join(docs_dir, "configuration.yml")
doc = YAML.load(File.read(environment_variable_file))
write "# Pact Broker Configuration\n\n"
# write "## Index"
-# doc['groups'].each do | group |
+# doc["groups"].each do | group |
# write "* #{group['title']}\n"
# group['vars'].each do | name, metadata |
@@ -42,43 +42,43 @@ def in_backticks value
write "\n"
-doc['groups'].each do | group |
+doc["groups"].each do | group |
write "
\n\n"
- write "## #{group['title']}\n\n
\n"
- if group['comments']
- write group['comments']
+ write "## #{group["title"]}\n\n
\n"
+ if group["comments"]
+ write group["comments"]
end
write "\n\n"
- group['vars'].each do | name, metadata |
- next if metadata['hidden']
+ group["vars"].each do | name, metadata |
+ next if metadata["hidden"]
write "### #{name}\n\n"
- write "#{metadata['description']}\n\n"
+ write "#{metadata["description"]}\n\n"
- write "**Required:** #{metadata['required'] || 'false'}
" if metadata['required']
- write "**Format:** #{metadata['format']}
" if metadata['format']
- write "**Default:** #{in_backticks(metadata['default'])}
" if !metadata['default'].nil?
- if metadata['allowed_values']
- allowed_values = metadata['allowed_values'].collect{ |val| in_backticks(val) }.join(', ')
+ write "**Required:** #{metadata["required"] || "false"}
" if metadata["required"]
+ write "**Format:** #{metadata["format"]}
" if metadata["format"]
+ write "**Default:** #{in_backticks(metadata["default"])}
" if !metadata["default"].nil?
+ if metadata["allowed_values"]
+ allowed_values = metadata["allowed_values"].collect{ |val| in_backticks(val) }.join(", ")
write "**Allowed values:** #{allowed_values}
"
end
- write "**Example:** #{in_backticks(metadata['example']) }
" if metadata['example']
- if metadata['examples']
- allowed_values = metadata['examples'].collect{ |val| in_backticks(val) }.join(', ')
+ write "**Example:** #{in_backticks(metadata["example"]) }
" if metadata["example"]
+ if metadata["examples"]
+ allowed_values = metadata["examples"].collect{ |val| in_backticks(val) }.join(", ")
write "**Examples:** #{allowed_values}
"
end
- write "**More information:** #{metadata['more_info']}
" if metadata['more_info']
+ write "**More information:** #{metadata["more_info"]}
" if metadata["more_info"]
write "\n"
end
end
-File.open(File.join(docs_dir, 'CONFIGURATION.md'), "w") { |file| file << $stream.string }
+File.open(File.join(docs_dir, "CONFIGURATION.md"), "w") { |file| file << $stream.string }
required_env_vars = []
-doc['groups'].each do | group |
- group['vars'].each do | name, metadata |
- required_env_vars << name if metadata['required'] && !metadata['default']
+doc["groups"].each do | group |
+ group["vars"].each do | name, metadata |
+ required_env_vars << name if metadata["required"] && !metadata["default"]
end
end