Class: OmgPullRequest::TestRunner::Base
Instance Attribute Summary collapse
Instance Method Summary
collapse
delegate_config_to
Constructor Details
#initialize(attributes = {}) ⇒ Base
Returns a new instance of Base.
7
8
9
10
11
12
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 7
def initialize(attributes={})
attributes.each do |attr, value|
self.send("#{attr}=", value)
end
self.success = false
end
|
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
4
5
6
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 4
def configuration
@configuration
end
|
#github_wrapper ⇒ Object
Returns the value of attribute github_wrapper.
4
5
6
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 4
def github_wrapper
@github_wrapper
end
|
#pull_request ⇒ Object
Returns the value of attribute pull_request.
4
5
6
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 4
def pull_request
@pull_request
end
|
#runtime ⇒ Object
Returns the value of attribute runtime.
4
5
6
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 4
def runtime
@runtime
end
|
#store ⇒ Object
Returns the value of attribute store.
4
5
6
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 4
def store
@store
end
|
#success ⇒ Object
Returns the value of attribute success.
4
5
6
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 4
def success
@success
end
|
Instance Method Details
#abbr_from_sha ⇒ Object
69
70
71
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 69
def abbr_from_sha
self.from_sha[0, 8]
end
|
#abbr_to_sha ⇒ Object
73
74
75
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 73
def abbr_to_sha
self.to_sha[0, 8]
end
|
#from_sha ⇒ Object
57
58
59
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 57
def from_sha
pull_request.base.sha
end
|
#git_client ⇒ Object
93
94
95
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 93
def git_client
@git_client ||= GitClient.new(:logger => logger, :configuration => self.configuration)
end
|
#issue_number ⇒ Object
77
78
79
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 77
def issue_number
pull_request.number
end
|
#log(message) ⇒ Object
101
102
103
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 101
def log(message)
logger.log(message)
end
|
#logger ⇒ Object
81
82
83
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 81
def logger
@logger ||= TestLogger.new(:store => self.store)
end
|
#lolcommits_client ⇒ Object
89
90
91
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 89
def lolcommits_client
@lolcommits ||= Lolcommits.new(:configuration => self.configuration, :github_wrapper => self.github_wrapper, :runner => self, :context => CONTEXT)
end
|
#notifier ⇒ Object
97
98
99
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 97
def notifier
@notifier ||= Notifier.new(:runner => self, :github_wrapper => self.configuration)
end
|
#prowl_client ⇒ Object
85
86
87
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 85
def prowl_client
@prowl_client ||= Prowl.new(:configuration => self.configuration, :logger => logger, :runner => self, :github_wrapper => self.github_wrapper)
end
|
#request_sha ⇒ Object
65
66
67
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 65
def request_sha
"#{self.from_sha}:#{self.to_sha}"
end
|
#run ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 18
def run
log_test_details!
make_status_test_running!
git_client.checkout!(from_sha)
merge_response = git_client.merge!(to_sha)
if merge_response == :conflict
make_status_conflict!
return
end
Bundler.with_clean_env do
setup
t = Time.now
self.success = execute_tests
self.runtime = Time.now - t
teardown
end
process_output!
end
|
#runtime_minutes ⇒ Object
49
50
51
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 49
def runtime_minutes
(runtime.to_f / 60).to_i
end
|
#runtime_seconds ⇒ Object
53
54
55
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 53
def runtime_seconds
(runtime.to_f % 60).round(3)
end
|
#success? ⇒ Boolean
45
46
47
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 45
def success?
self.success
end
|
#to_sha ⇒ Object
61
62
63
|
# File 'lib/omg_pull_request/test_runner/base.rb', line 61
def to_sha
pull_request.head.sha
end
|