Class: Danger::RequestSources::RequestSource
- Inherits:
-
Object
- Object
- Danger::RequestSources::RequestSource
show all
- Defined in:
- lib/danger/request_sources/request_source.rb
Constant Summary
collapse
- DANGER_REPO_NAME =
"danger"
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(_ci_source, _environment) ⇒ RequestSource
Returns a new instance of RequestSource.
37
38
39
|
# File 'lib/danger/request_sources/request_source.rb', line 37
def initialize(_ci_source, _environment)
raise "Subclass and overwrite initialize"
end
|
Instance Attribute Details
#ci_source ⇒ Object
Returns the value of attribute ci_source.
8
9
10
|
# File 'lib/danger/request_sources/request_source.rb', line 8
def ci_source
@ci_source
end
|
#host ⇒ Object
Returns the value of attribute host.
8
9
10
|
# File 'lib/danger/request_sources/request_source.rb', line 8
def host
@host
end
|
#ignored_violations ⇒ Object
Returns the value of attribute ignored_violations.
8
9
10
|
# File 'lib/danger/request_sources/request_source.rb', line 8
def ignored_violations
@ignored_violations
end
|
#scm ⇒ Object
Returns the value of attribute scm.
8
9
10
|
# File 'lib/danger/request_sources/request_source.rb', line 8
def scm
@scm
end
|
Class Method Details
.available_request_sources ⇒ Object
23
24
25
|
# File 'lib/danger/request_sources/request_source.rb', line 23
def self.available_request_sources
@available_request_sources ||= Set.new
end
|
.available_source_names_and_envs ⇒ Object
31
32
33
34
35
|
# File 'lib/danger/request_sources/request_source.rb', line 31
def self.available_source_names_and_envs
available_request_sources.map do |klass|
" - #{klass.source_name}: #{klass.env_vars.join(', ').yellow}"
end
end
|
.env_vars ⇒ Object
10
11
12
|
# File 'lib/danger/request_sources/request_source.rb', line 10
def self.env_vars
raise "Subclass and overwrite self.env_vars"
end
|
.inherited(child_class) ⇒ Object
18
19
20
21
|
# File 'lib/danger/request_sources/request_source.rb', line 18
def self.inherited(child_class)
available_request_sources.add child_class
super
end
|
.optional_env_vars ⇒ Object
14
15
16
|
# File 'lib/danger/request_sources/request_source.rb', line 14
def self.optional_env_vars
[]
end
|
.source_name ⇒ Object
27
28
29
|
# File 'lib/danger/request_sources/request_source.rb', line 27
def self.source_name
to_s.sub("Danger::RequestSources::", "")
end
|
Instance Method Details
#fetch_details ⇒ Object
80
81
82
|
# File 'lib/danger/request_sources/request_source.rb', line 80
def fetch_details
raise "Subclass and overwrite initialize"
end
|
#file_url(_organisation: nil, _repository: nil, _ref: nil, _branch: nil, _path: nil) ⇒ Object
88
89
90
|
# File 'lib/danger/request_sources/request_source.rb', line 88
def file_url(_organisation: nil, _repository: nil, _ref: nil, _branch: nil, _path: nil)
raise "Subclass and overwrite file_url"
end
|
#inspect ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'lib/danger/request_sources/request_source.rb', line 41
def inspect
inspected = super
inspected.gsub!(@token, "********") if @token
inspected.gsub!(@access_token, "********") if @access_token
inspected.gsub!(@bearer_token, "********") if @bearer_token
inspected
end
|
#organisation ⇒ Object
84
85
86
|
# File 'lib/danger/request_sources/request_source.rb', line 84
def organisation
raise "Subclass and overwrite organisation"
end
|
#setup_danger_branches ⇒ Object
76
77
78
|
# File 'lib/danger/request_sources/request_source.rb', line 76
def setup_danger_branches
raise "Subclass and overwrite setup_danger_branches"
end
|
#update_build_status(_status) ⇒ Object
92
93
94
|
# File 'lib/danger/request_sources/request_source.rb', line 92
def update_build_status(_status)
raise "Subclass and overwrite update_build_status"
end
|
#update_pull_request!(_warnings: [], _errors: [], _messages: [], _markdowns: []) ⇒ Object
72
73
74
|
# File 'lib/danger/request_sources/request_source.rb', line 72
def update_pull_request!(_warnings: [], _errors: [], _messages: [], _markdowns: [])
raise "Subclass and overwrite update_pull_request!"
end
|
#validates_as_api_source? ⇒ Boolean
56
57
58
|
# File 'lib/danger/request_sources/request_source.rb', line 56
def validates_as_api_source?
raise "Subclass and overwrite validates_as_api_source?"
end
|
#validates_as_ci? ⇒ Boolean
Returns whether scm.origins is a valid git repository or not.
52
53
54
|
# File 'lib/danger/request_sources/request_source.rb', line 52
def validates_as_ci?
!!self.scm.origins.match(%r{#{Regexp.escape self.host}(:|/)(.+/.+?)(?:\.git)?$})
end
|