Skip to content

Instantly share code, notes, and snippets.

@radar
Created July 26, 2010 07:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radar/53f8a67c0a8854b45a2c to your computer and use it in GitHub Desktop.
Save radar/53f8a67c0a8854b45a2c to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'mechanize'
require 'ruby-debug'
# spambottestingpassword
bastards = [108789, 107772, 107926, 108790, 108809]
agent = Mechanize.new
# Logging in
page = agent.get('http://rails.lighthouseapp.com/login')
# There's two forms, use the login form not the open id form
login_form = page.forms[1]
login_form.email = "radarlistener@gmail.com"
login_form.password = "spambottestingpassword"
page = agent.submit(login_form, login_form.buttons.first)
bastards.each do |bastard|
page = agent.get("http://rails.lighthouseapp.com/users/#{bastard}")
puts "NEXT BASTARD"
pp page.title
# Get all their ticket comments
links = page.links.select { |l| l.href =~ /tickets\/\d+/ }.map(&:href).uniq
links.each do |link|
numbers = /#ticket-(\d+)-(\d+)/.match(link)
page = agent.get("https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/#{numbers[1]}/versions/#{numbers[2]}")
delete_form = page.forms.detect { |f| f.buttons.detect { |b| b.value == "Yes, delete this ticket comment." } }
agent.submit(delete_form, delete_form.buttons.first)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment