Class: Publisher::Helpers::UrlSectionBuilder
- Inherits:
-
Object
- Object
- Publisher::Helpers::UrlSectionBuilder
- Defined in:
- lib/allure_report_publisher/lib/helpers/url_section_builder.rb
Overview
Urls section builder
Constant Summary collapse
- DESCRIPTION_PATTERN =
/<!-- allure -->[\s\S]+<!-- allurestop -->/
- JOBS_PATTERN =
/<!-- jobs -->(?<jobs>[\s\S]+)<!-- jobs -->/
Instance Attribute Summary collapse
-
#build_name ⇒ Object
readonly
Returns the value of attribute build_name.
-
#collapse_summary ⇒ Object
readonly
Returns the value of attribute collapse_summary.
-
#flaky_warning_status ⇒ Object
readonly
Returns the value of attribute flaky_warning_status.
-
#report_path ⇒ Object
readonly
Returns the value of attribute report_path.
-
#report_title ⇒ Object
readonly
Returns the value of attribute report_title.
-
#report_url ⇒ Object
readonly
Returns the value of attribute report_url.
-
#sha_url ⇒ Object
readonly
Returns the value of attribute sha_url.
-
#summary_table_type ⇒ Object
readonly
Returns the value of attribute summary_table_type.
-
#summary_type ⇒ Object
readonly
Returns the value of attribute summary_type.
Class Method Summary collapse
-
.match?(urls_block) ⇒ Boolean
Matches url section pattern.
Instance Method Summary collapse
-
#comment_body(pr_comment = nil) ⇒ String
Comment body with allure report urls.
-
#initialize(**args) ⇒ UrlSectionBuilder
constructor
Url section builder.
-
#updated_pr_description(pr_description) ⇒ String
PR description with allure report urls.
Constructor Details
#initialize(**args) ⇒ UrlSectionBuilder
Url section builder
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/allure_report_publisher/lib/helpers/url_section_builder.rb', line 19 def initialize(**args) @report_url = args[:report_url] @report_path = args[:report_path] @build_name = args[:build_name] @sha_url = args[:sha_url] @summary_type = args[:summary_type] @summary_table_type = args[:summary_table_type] @collapse_summary = args[:collapse_summary] @flaky_warning_status = args[:flaky_warning_status] @report_title = args[:report_title] end |
Instance Attribute Details
#build_name ⇒ Object (readonly)
Returns the value of attribute build_name.
65 66 67 |
# File 'lib/allure_report_publisher/lib/helpers/url_section_builder.rb', line 65 def build_name @build_name end |
#collapse_summary ⇒ Object (readonly)
Returns the value of attribute collapse_summary.
65 66 67 |
# File 'lib/allure_report_publisher/lib/helpers/url_section_builder.rb', line 65 def collapse_summary @collapse_summary end |
#flaky_warning_status ⇒ Object (readonly)
Returns the value of attribute flaky_warning_status.
65 66 67 |
# File 'lib/allure_report_publisher/lib/helpers/url_section_builder.rb', line 65 def flaky_warning_status @flaky_warning_status end |
#report_path ⇒ Object (readonly)
Returns the value of attribute report_path.
65 66 67 |
# File 'lib/allure_report_publisher/lib/helpers/url_section_builder.rb', line 65 def report_path @report_path end |
#report_title ⇒ Object (readonly)
Returns the value of attribute report_title.
65 66 67 |
# File 'lib/allure_report_publisher/lib/helpers/url_section_builder.rb', line 65 def report_title @report_title end |
#report_url ⇒ Object (readonly)
Returns the value of attribute report_url.
65 66 67 |
# File 'lib/allure_report_publisher/lib/helpers/url_section_builder.rb', line 65 def report_url @report_url end |
#sha_url ⇒ Object (readonly)
Returns the value of attribute sha_url.
65 66 67 |
# File 'lib/allure_report_publisher/lib/helpers/url_section_builder.rb', line 65 def sha_url @sha_url end |
#summary_table_type ⇒ Object (readonly)
Returns the value of attribute summary_table_type.
65 66 67 |
# File 'lib/allure_report_publisher/lib/helpers/url_section_builder.rb', line 65 def summary_table_type @summary_table_type end |
#summary_type ⇒ Object (readonly)
Returns the value of attribute summary_type.
65 66 67 |
# File 'lib/allure_report_publisher/lib/helpers/url_section_builder.rb', line 65 def summary_type @summary_type end |
Class Method Details
.match?(urls_block) ⇒ Boolean
Matches url section pattern
35 36 37 |
# File 'lib/allure_report_publisher/lib/helpers/url_section_builder.rb', line 35 def self.match?(urls_block) urls_block.match?(DESCRIPTION_PATTERN) end |
Instance Method Details
#comment_body(pr_comment = nil) ⇒ String
Comment body with allure report urls
58 59 60 61 62 63 |
# File 'lib/allure_report_publisher/lib/helpers/url_section_builder.rb', line 58 def comment_body(pr_comment = nil) return url_section(separator: false) unless pr_comment job_entries = jobs_section(pr_comment) url_section(job_entries: job_entries, separator: false) end |
#updated_pr_description(pr_description) ⇒ String
PR description with allure report urls
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/allure_report_publisher/lib/helpers/url_section_builder.rb', line 43 def updated_pr_description(pr_description) stripped_description = (pr_description || "").strip return url_section(separator: false) if stripped_description == "" return "#{pr_description}\n\n#{url_section}" unless pr_description.match?(DESCRIPTION_PATTERN) job_entries = jobs_section(pr_description) non_empty = stripped_description != pr_description.match(DESCRIPTION_PATTERN)[0] pr_description.gsub(DESCRIPTION_PATTERN, url_section(job_entries: job_entries, separator: non_empty)) end |