Last active
November 10, 2015 16:30
-
-
Save elandesign/f046303792204e53b110 to your computer and use it in GitHub Desktop.
Rerun failed specs from Jenkins output
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
javascript:(function()%7Bfunction%20callback()%7Bvar%20output%20%3D%20%24(%22pre%22).text()%3Bvar%20failures%20%3D%20output.match(%2Frspec%20%5C.%5C%2F%5B%5E%20%5D%2B%2Fg)%3Bvar%20command%20%3D%20%22rspec%20%22%20%2B%20failures.map(function(s)%7Breturn%20s.match(%2F%5C.%5C%2F.*%2F)%5B0%5D%7D).join(%22%20%22)%3Bif(%24(%22%23rerun%22).length%20%3D%3D%200)%24(%22%23main-table%22).prepend(%22%3Cthead%3E%3Ctr%3E%3Ctd%20colspan%3D%5C%222%5C%22%20id%3D%5C%22rerun%5C%22%3E%22%20%2B%20command%20%2B%20%22%3C%2Ftd%3E%3C%2Ftr%3E%3C%2Fthead%3E%22)%7Dvar%20s%3Ddocument.createElement(%22script%22)%3Bs.src%3D%22https%3A%2F%2Fcode.jquery.com%2Fjquery-1.11.3.min.js%22%3Bif(s.addEventListener)%7Bs.addEventListener(%22load%22%2Ccallback%2Cfalse)%7Delse%20if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)() |
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
(function() { | |
function callback() { | |
var output = $("pre").text(); | |
var failures = output.match(/rspec \.\/[^ ]+/g); | |
var command = "rspec " + failures.map(function(s) { | |
return s.match(/\.\/.*/)[0] | |
}).join(" "); | |
if ($("#rerun").length == 0) $("#main-table").prepend("<thead><tr><td colspan=\"2\" id=\"rerun\">" + command + "</td></tr></thead>") | |
} | |
var s = document.createElement("script"); | |
s.src = "https://code.jquery.com/jquery-1.11.3.min.js"; | |
if (s.addEventListener) { | |
s.addEventListener("load", callback, false) | |
} else if (s.readyState) { | |
s.onreadystatechange = callback | |
} | |
document.body.appendChild(s); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment