Class: Bard::CLI::CI
- Inherits:
-
Struct
- Object
- Struct
- Bard::CLI::CI
- Defined in:
- lib/bard/ci.rb
Instance Attribute Summary collapse
-
#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
#last_response ⇒ Object
Returns the value of attribute last_response.
27 28 29 |
# File 'lib/bard/ci.rb', line 27 def last_response @last_response end |
#project_name ⇒ Object
Returns the value of attribute project_name
2 3 4 |
# File 'lib/bard/ci.rb', line 2 def project_name @project_name end |
#sha ⇒ Object
Returns the value of attribute sha
2 3 4 |
# File 'lib/bard/ci.rb', line 2 def sha @sha end |
Instance Method Details
#console ⇒ Object
22 23 24 25 |
# File 'lib/bard/ci.rb', line 22 def console raw = `curl -s #{ci_host}/lastBuild/console?token=botandrose` raw[%r{<pre.*?>(.+)</pre>}m, 1] end |
#exists? ⇒ Boolean
18 19 20 |
# File 'lib/bard/ci.rb', line 18 def exists? `curl -s -I #{ci_host}/?token=botandrose` =~ /\b200 OK\b/ end |
#run ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/bard/ci.rb', line 3 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 |