Skip to content
Snippets Groups Projects
Commit b0b5d22a authored by Martin Afanasjew's avatar Martin Afanasjew
Browse files

man: modernize and reduce code duplication


Also use `popen_read` instead of `safe_system` for cleaner argument
passing and write the output with `atomic_write`.

Closes Homebrew/homebrew#46826.

Signed-off-by: default avatarMartin Afanasjew <martin@afanasjew.de>
parent 4a89cfb1
No related branches found
No related tags found
No related merge requests found
......@@ -26,10 +26,19 @@ module Homebrew
puts "Writing manpages to #{TARGET_PATH}"
Dir["#{SOURCE_PATH}/*.md"].each do |source_file|
target_html = DOC_PATH/"#{File.basename(source_file, ".md")}.html"
safe_system "ronn --fragment --pipe --organization='Homebrew' --manual='brew' #{source_file} > #{target_html}"
target_man = TARGET_PATH/File.basename(source_file, ".md")
safe_system "ronn --roff --pipe --organization='Homebrew' --manual='brew' #{source_file} > #{target_man}"
args = %W[
--pipe
--organization=Homebrew
--manual=brew
#{source_file}
]
page = File.basename(source_file, ".md")
target_html = DOC_PATH/"#{page}.html"
target_html.atomic_write Utils.popen_read("ronn", "--fragment", *args)
target_man = TARGET_PATH/page
target_man.atomic_write Utils.popen_read("ronn", "--roff", *args)
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment