Created
May 9, 2018 12:49
-
-
Save pj4533/927abe2c288f0cd692e1a83684b65a90 to your computer and use it in GitHub Desktop.
Quick script to get status of a travis repo from the SVG link on the command line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'nokogiri' | |
require 'open-uri' | |
html_data = open(ARGV[0]).read | |
@test = Nokogiri::HTML(html_data) | |
status_string = @test.xpath('//text').map.each.each { |i| i.inner_text }.last | |
color_code = 31 # red | |
if status_string == "passing" | |
color_code = 32 # green | |
end | |
puts "\e[#{color_code}m#{status_string}\e[0m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment