Skip to content

Instantly share code, notes, and snippets.

@hinke
Created October 2, 2012 21:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hinke/3823496 to your computer and use it in GitHub Desktop.
Save hinke/3823496 to your computer and use it in GitHub Desktop.
Fetch headers from build image and do something
get '/travis/:id/status' do |id|
token = "token!!"
http = Net::HTTP.new('magnum.travis-ci.com', 443)
http.use_ssl = true
path = "/Readmill/#{id}.png?token=#{token}"
response = http.head(path, nil)
if response['Content-Disposition'].include?('failing')
@message = "The build failed."
@background = "red"
else
@message = "The build passed."
@background = "green"
end
erb :travis_status, :layout => false
end
@marten
Copy link

marten commented Oct 8, 2012

How does @background work? Do you do some trick with HTML in the Geckoboard text-widget?

@hinke
Copy link
Author

hinke commented Nov 29, 2012

@marten Oh, sorry for late reply.Yes, I just do a div where I set the background color.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment