Class: Danger::RequestSources::RequestSource
- Inherits:
-
Object
- Object
- Danger::RequestSources::RequestSource
- Defined in:
- lib/danger/request_source/request_source.rb
Direct Known Subclasses
Constant Summary collapse
- DANGER_REPO_NAME =
"danger".freeze
Instance Attribute Summary collapse
-
#ci_source ⇒ Object
Returns the value of attribute ci_source.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#host ⇒ Object
Returns the value of attribute host.
-
#ignored_violations ⇒ Object
Returns the value of attribute ignored_violations.
-
#scm ⇒ Object
Returns the value of attribute scm.
Class Method Summary collapse
Instance Method Summary collapse
- #danger_repo?(_organisation: nil, _repository: nil) ⇒ Boolean
- #fetch_danger_repo(_organisation: nil) ⇒ Object
- #fetch_details ⇒ Object
- #fetch_repository(_organisation: nil, _repository: nil) ⇒ Object
- #file_url(_organisation: nil, _repository: nil, _branch: "master", _path: nil) ⇒ Object
-
#initialize(_ci_source, _environment) ⇒ RequestSource
constructor
A new instance of RequestSource.
- #organisation ⇒ Object
- #setup_danger_branches ⇒ Object
- #update_pull_request!(_warnings: [], _errors: [], _messages: [], _markdowns: []) ⇒ Object
- #validates? ⇒ Boolean
Constructor Details
#initialize(_ci_source, _environment) ⇒ RequestSource
Returns a new instance of RequestSource.
17 18 19 |
# File 'lib/danger/request_source/request_source.rb', line 17 def initialize(_ci_source, _environment) raise "Subclass and overwrite initialize" end |
Instance Attribute Details
#ci_source ⇒ Object
Returns the value of attribute ci_source.
6 7 8 |
# File 'lib/danger/request_source/request_source.rb', line 6 def ci_source @ci_source end |
#environment ⇒ Object
Returns the value of attribute environment.
6 7 8 |
# File 'lib/danger/request_source/request_source.rb', line 6 def environment @environment end |
#host ⇒ Object
Returns the value of attribute host.
6 7 8 |
# File 'lib/danger/request_source/request_source.rb', line 6 def host @host end |
#ignored_violations ⇒ Object
Returns the value of attribute ignored_violations.
6 7 8 |
# File 'lib/danger/request_source/request_source.rb', line 6 def ignored_violations @ignored_violations end |
#scm ⇒ Object
Returns the value of attribute scm.
6 7 8 |
# File 'lib/danger/request_source/request_source.rb', line 6 def scm @scm end |
Class Method Details
.available_request_sources ⇒ Object
13 14 15 |
# File 'lib/danger/request_source/request_source.rb', line 13 def self.available_request_sources @available_request_sources ||= Set.new end |
.inherited(child_class) ⇒ Object
8 9 10 11 |
# File 'lib/danger/request_source/request_source.rb', line 8 def self.inherited(child_class) available_request_sources.add child_class super end |
Instance Method Details
#danger_repo?(_organisation: nil, _repository: nil) ⇒ Boolean
61 62 63 |
# File 'lib/danger/request_source/request_source.rb', line 61 def danger_repo?(_organisation: nil, _repository: nil) raise "Subclass and overwrite danger_repo?" end |
#fetch_danger_repo(_organisation: nil) ⇒ Object
57 58 59 |
# File 'lib/danger/request_source/request_source.rb', line 57 def fetch_danger_repo(_organisation: nil) raise "Subclass and overwrite fetch_danger_repo" end |
#fetch_details ⇒ Object
45 46 47 |
# File 'lib/danger/request_source/request_source.rb', line 45 def fetch_details raise "Subclass and overwrite initialize" end |
#fetch_repository(_organisation: nil, _repository: nil) ⇒ Object
53 54 55 |
# File 'lib/danger/request_source/request_source.rb', line 53 def fetch_repository(_organisation: nil, _repository: nil) raise "Subclass and overwrite fetch_repository" end |
#file_url(_organisation: nil, _repository: nil, _branch: "master", _path: nil) ⇒ Object
65 66 67 |
# File 'lib/danger/request_source/request_source.rb', line 65 def file_url(_organisation: nil, _repository: nil, _branch: "master", _path: nil) raise "Subclass and overwrite file_url" end |
#organisation ⇒ Object
49 50 51 |
# File 'lib/danger/request_source/request_source.rb', line 49 def organisation raise "Subclass and overwrite organisation" end |
#setup_danger_branches ⇒ Object
41 42 43 |
# File 'lib/danger/request_source/request_source.rb', line 41 def setup_danger_branches raise "Subclass and overwrite setup_danger_branches" end |
#update_pull_request!(_warnings: [], _errors: [], _messages: [], _markdowns: []) ⇒ Object
37 38 39 |
# File 'lib/danger/request_source/request_source.rb', line 37 def update_pull_request!(_warnings: [], _errors: [], _messages: [], _markdowns: []) raise "Subclass and overwrite update_pull_request!" end |
#validates? ⇒ Boolean
21 22 23 |
# File 'lib/danger/request_source/request_source.rb', line 21 def validates? !!self.scm.origins.match(%r{#{Regexp.escape self.host}(:|/)(?<repo_slug>.+/.+?)(?:\.git)?$}) end |