Class: Bard::CLI::CI::Remote

Inherits:
Struct
  • Object
show all
Defined in:
lib/bard/ci.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#last_responseObject

Returns the value of attribute last_response.



49
50
51
# File 'lib/bard/ci.rb', line 49

def last_response
  @last_response
end

#project_nameObject

Returns the value of attribute project_name



24
25
26
# File 'lib/bard/ci.rb', line 24

def project_name
  @project_name
end

#shaObject

Returns the value of attribute sha



24
25
26
# File 'lib/bard/ci.rb', line 24

def sha
  @sha
end

Instance Method Details

#consoleObject



44
45
46
47
# File 'lib/bard/ci.rb', line 44

def console
  raw = `curl -s #{ci_host}/lastBuild/console`
  raw[%r{<pre.*?>(.+)</pre>}m, 1]
end

#exists?Boolean



40
41
42
# File 'lib/bard/ci.rb', line 40

def exists?
  `curl -s -I #{ci_host}/` =~ /\b200 OK\b/
end

#runObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/bard/ci.rb', line 25

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