Class: CiToolkit::PrMessenger

Inherits:
Object
  • Object
show all
Defined in:
lib/ci_toolkit/pr_messenger.rb

Overview

Sends messages to a Github PR for predefined build events

Instance Method Summary collapse

Constructor Details

#initialize(github_pr = CiToolkit::DvcsPrFactory.create(CiToolkit::BitriseEnv.new), messenger_text = CiToolkit::PrMessengerText.new) ⇒ PrMessenger

Returns a new instance of PrMessenger.



6
7
8
9
10
11
12
13
# File 'lib/ci_toolkit/pr_messenger.rb', line 6

def initialize(
  github_pr = CiToolkit::DvcsPrFactory.create(CiToolkit::BitriseEnv.new),
  messenger_text = CiToolkit::PrMessengerText.new
)
  @github_pr = github_pr
  @messenger_text = messenger_text
  @is_connected = !@github_pr.nil?
end

Instance Method Details

#delete_big_pr_warningObject



73
74
75
# File 'lib/ci_toolkit/pr_messenger.rb', line 73

def delete_big_pr_warning
  delete(@messenger_text.big_pr_warning_title)
end

#delete_certificate_pinning_modified_android_warningObject



63
64
65
# File 'lib/ci_toolkit/pr_messenger.rb', line 63

def delete_certificate_pinning_modified_android_warning
  delete(@messenger_text.certificate_pinning_logic_modified_android_title)
end

#delete_ci_failedObject



24
25
26
# File 'lib/ci_toolkit/pr_messenger.rb', line 24

def delete_ci_failed
  delete(@messenger_text.build_failure_title)
end

#delete_duplicate_files_reportObject



35
36
37
# File 'lib/ci_toolkit/pr_messenger.rb', line 35

def delete_duplicate_files_report
  delete(@messenger_text.duplicated_files_title)
end

#delete_lint_reportObject



45
46
47
# File 'lib/ci_toolkit/pr_messenger.rb', line 45

def delete_lint_report
  delete(@messenger_text.lint_report_title)
end

#delete_realm_modified_warningObject



54
55
56
# File 'lib/ci_toolkit/pr_messenger.rb', line 54

def delete_realm_modified_warning
  delete(@messenger_text.realm_modified_warning_title)
end

#delete_work_in_progressObject



83
84
85
# File 'lib/ci_toolkit/pr_messenger.rb', line 83

def delete_work_in_progress
  delete(@messenger_text.work_in_progress_title)
end

#send_big_pr_warningObject



67
68
69
70
71
# File 'lib/ci_toolkit/pr_messenger.rb', line 67

def send_big_pr_warning
  delete_big_pr_warning
  send(@messenger_text.big_pr_warning_title)
  @messenger_text.big_pr_warning_title
end

#send_build_deployed(name, version_name, tag) ⇒ Object



15
16
17
# File 'lib/ci_toolkit/pr_messenger.rb', line 15

def send_build_deployed(name, version_name, tag)
  send(@messenger_text.for_new_build(name, version_name, tag))
end

#send_certificate_pinning_modified_android_warningObject



58
59
60
61
# File 'lib/ci_toolkit/pr_messenger.rb', line 58

def send_certificate_pinning_modified_android_warning
  delete_certificate_pinning_modified_android_warning
  send(@messenger_text.certificate_pinning_logic_modified_android_title)
end

#send_ci_failed(reason) ⇒ Object



19
20
21
22
# File 'lib/ci_toolkit/pr_messenger.rb', line 19

def send_ci_failed(reason)
  delete_ci_failed
  send(@messenger_text.for_build_failure(reason))
end

#send_duplicate_files_report(finder) ⇒ Object



28
29
30
31
32
33
# File 'lib/ci_toolkit/pr_messenger.rb', line 28

def send_duplicate_files_report(finder)
  delete_duplicate_files_report
  report = @messenger_text.create_duplicate_files_report(finder)
  send(@messenger_text.for_duplicated_files_report(report))
  report
end

#send_lint_report(report) ⇒ Object



39
40
41
42
43
# File 'lib/ci_toolkit/pr_messenger.rb', line 39

def send_lint_report(report)
  delete_lint_report
  send(@messenger_text.for_lint_report(report))
  report
end

#send_realm_modified_warningObject



49
50
51
52
# File 'lib/ci_toolkit/pr_messenger.rb', line 49

def send_realm_modified_warning
  delete_realm_modified_warning
  send(@messenger_text.realm_modified_warning_title)
end

#send_work_in_progressObject



77
78
79
80
81
# File 'lib/ci_toolkit/pr_messenger.rb', line 77

def send_work_in_progress
  delete_work_in_progress
  send(@messenger_text.work_in_progress_title)
  @messenger_text.work_in_progress_title
end