Class: Makit::Markdown
- Inherits:
-
Object
- Object
- Makit::Markdown
- Defined in:
- lib/makit/markdown.rb
Class Method Summary collapse
- .get_command_markdown(command) ⇒ Object
- .get_commands_markdown(commands) ⇒ Object
- .get_make_result_markdown(make_result) ⇒ Object
Class Method Details
.get_command_markdown(command) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/makit/markdown.rb', line 17 def self.get_command_markdown(command) md = "<details>\n" md += "<summary>#{Makit::Humanize.get_command_summary(command)}</summary>\n\n" if command.output.length.positive? md += "<table><tr><th>output</th></tr><tr><td>\n\n" # <pre>\n" md += "```shell\n" md += "#{command.output}\n" md += "```\n\n" md += "</td></tr></table>\n\n" # md += "output:\n" # md += "```shell\n" # md += "#{command.output}\n" # md += "```\n\n" end if command.error.length.positive? md += "error:\n" md += "```shell\n" md += "#{command.error}\n" md += "```\n\n" end md += "| exit code | started at | duration | user | device | os | directory |\n" md += "| --- | --- | --- | --- | --- | --- | --- |\n" md += "| #{command.exit_code} | #{Makit::Humanize.get_protobuf_timestamp(command.started_at)} | #{Makit::Humanize.get_protobuf_duration(command.duration)} | #{command.user} | #{command.device} | #{command.os} | #{command.directory} |\n" # md += "| Name | Value |\n" # md += "| --- | --- |\n" # md += "| exit code | #{command.exit_code} |\n" # md += "| started at | #{Makit::Humanize::get_protobuf_timestamp(command.started_at)} |\n" # md += "| duration | #{Makit::Humanize::get_protobuf_duration(command.duration)} |\n" # md += "| user | #{command.user} |\n" # md += "| device | #{command.device} |\n" # md += "| os | #{command.os} |\n" # md += "| directory | #{command.directory} |\n" md += "</details>\n" md end |
.get_commands_markdown(commands) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/makit/markdown.rb', line 8 def self.get_commands_markdown(commands) summary = "" commands.each do |command| md = Makit::Markdown.get_command_markdown(command) summary += md end summary end |
.get_make_result_markdown(make_result) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/makit/markdown.rb', line 55 def self.get_make_result_markdown(make_result) md = "# Make Result\n" # display allow of the fields of the MakeResult message md += "| Name | Value |\n" md += "| --- | --- |\n" md += "| repository | #{make_result.repository} |\n" md += "| commit | #{make_result.commit} |\n" md += "| branch | #{make_result.branch} |\n" md += "| tag | #{make_result.tag} |\n" md += "| device | #{make_result.device} |\n" md += "| runtime identifier | #{make_result.runtime_identifier} |\n" md += "| initial size | #{make_result.initial_size} |\n" md += "| final size | #{make_result.final_size} |\n" md += "\n" md += "## Commands\n" make_result.commands.each do |command| md += Makit::Markdown.get_command_markdown(command) end end |