Class: Bard::CI::Jenkins
- Inherits:
-
Struct
- Object
- Struct
- Bard::CI::Jenkins
- Defined in:
- lib/bard/ci/jenkins.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#last_response ⇒ Object
Returns the value of attribute last_response.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#sha ⇒ Object
Returns the value of attribute sha.
Instance Method Summary collapse
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch
5 6 7 |
# File 'lib/bard/ci/jenkins.rb', line 5 def branch @branch end |
#last_response ⇒ Object
Returns the value of attribute last_response.
30 31 32 |
# File 'lib/bard/ci/jenkins.rb', line 30 def last_response @last_response end |
#project_name ⇒ Object
Returns the value of attribute project_name
5 6 7 |
# File 'lib/bard/ci/jenkins.rb', line 5 def project_name @project_name end |
#sha ⇒ Object
Returns the value of attribute sha
5 6 7 |
# File 'lib/bard/ci/jenkins.rb', line 5 def sha @sha end |
Instance Method Details
#console ⇒ Object
25 26 27 28 |
# File 'lib/bard/ci/jenkins.rb', line 25 def console raw = `curl -s #{ci_host}/lastBuild/console` raw[%r{<pre.*?>(.+)</pre>}m, 1] end |
#exists? ⇒ Boolean
21 22 23 |
# File 'lib/bard/ci/jenkins.rb', line 21 def exists? `curl -s -I #{ci_host}/` =~ /\b200 OK\b/ end |
#run ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/bard/ci/jenkins.rb', line 6 def run last_time_elapsed = get_last_time_elapsed start sleep(2) until started? start_time = Time.new.to_i while building? elapsed_time = Time.new.to_i - start_time yield elapsed_time, last_time_elapsed sleep(2) end success? end |