Class: GitlabDanger
- Inherits:
-
Object
- Object
- GitlabDanger
- Defined in:
- lib/gitlab_danger.rb
Constant Summary collapse
- MESSAGE_PREFIX =
'==>'.freeze
Instance Attribute Summary collapse
-
#gitlab_danger_helper ⇒ Object
readonly
Returns the value of attribute gitlab_danger_helper.
Class Method Summary collapse
Instance Method Summary collapse
- #ci? ⇒ Boolean
- #html_link(str) ⇒ Object
-
#initialize(gitlab_danger_helper) ⇒ GitlabDanger
constructor
A new instance of GitlabDanger.
- #rule_names ⇒ Object
Constructor Details
#initialize(gitlab_danger_helper) ⇒ GitlabDanger
Returns a new instance of GitlabDanger.
33 34 35 |
# File 'lib/gitlab_danger.rb', line 33 def initialize(gitlab_danger_helper) @gitlab_danger_helper = gitlab_danger_helper end |
Instance Attribute Details
#gitlab_danger_helper ⇒ Object (readonly)
Returns the value of attribute gitlab_danger_helper
31 32 33 |
# File 'lib/gitlab_danger.rb', line 31 def gitlab_danger_helper @gitlab_danger_helper end |
Class Method Details
.local_warning_message ⇒ Object
37 38 39 |
# File 'lib/gitlab_danger.rb', line 37 def self. "#{MESSAGE_PREFIX} Only the following Danger rules can be run locally: #{LOCAL_RULES.join(', ')}" end |
.success_message ⇒ Object
41 42 43 |
# File 'lib/gitlab_danger.rb', line 41 def self. "#{MESSAGE_PREFIX} No Danger rule violations!" end |
Instance Method Details
#ci? ⇒ Boolean
53 54 55 |
# File 'lib/gitlab_danger.rb', line 53 def ci? !gitlab_danger_helper.nil? end |
#html_link(str) ⇒ Object
49 50 51 |
# File 'lib/gitlab_danger.rb', line 49 def html_link(str) self.ci? ? gitlab_danger_helper.html_link(str) : str end |
#rule_names ⇒ Object
45 46 47 |
# File 'lib/gitlab_danger.rb', line 45 def rule_names ci? ? LOCAL_RULES | CI_ONLY_RULES : LOCAL_RULES end |