Created
January 29, 2010 20:17
-
-
Save ruckus/290077 to your computer and use it in GitHub Desktop.
This file contains 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
# If you DONT automatically resolve your errors on each deploy than they accumulate in HopToad | |
# Unfortunately HopToad doesnt offer a way to mass edit errors (mark them as resolved, specifically) | |
# This script to the rescue | |
require 'rubygems' | |
require 'mechanize' | |
a = WWW::Mechanize.new | |
a.get('https://yourdomain.hoptoadapp.com/login') do |page| | |
# Submit the login form | |
auth_token = page.search("//input[@type='hidden']").first.attributes['value'] | |
puts "Auth token: #{auth_token}" | |
my_page = page.form_with(:action => 'https://yourdomain.hoptoadapp.com/session') do |f| | |
f['session[email]'] = 'email' | |
f['session[password]'] = 'password' | |
f.authenticity_token = auth_token | |
end.submit | |
error_ids = [] | |
my_page.links.each do |link| | |
text = link.href.strip | |
next unless text.length > 0 | |
if text =~ /^https\:\/\/yourdomain\.hoptoadapp\.com\/errors\/(\d+)/ | |
error_ids << $1 | |
end | |
end | |
error_ids.uniq.each do |error_id| | |
a.get("https://yourdomain.hoptoadapp.com/errors/#{error_id}") do |page| | |
# click the mark as resolved button | |
page.form_with(:action => "/errors/#{error_id}") do |form| | |
form.authenticity_token = auth_token | |
form['group[resolved]'] = 1 | |
end.submit | |
puts "#{error_id}: Resolved!" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment