Skip to content

Instantly share code, notes, and snippets.

@corroded
Created May 20, 2011 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save corroded/982479 to your computer and use it in GitHub Desktop.
Save corroded/982479 to your computer and use it in GitHub Desktop.
This is a mechanize github message sender for the authors of all cucumber tmbundle forks
require 'rubygems'
require 'mechanize'
require 'net/http'
require 'json'
#get the tmbundle forkers
url = "http://github.com/api/v2/json/repos/show/cucumber/cucumber-tmbundle/network"
cuke_tmbundle_forkers = JSON.parse(Net::HTTP.get_response(URI.parse(url)).body).first[1].map{ |x| x["owner"] }
agent = Mechanize.new
# Get the github sign in page
page = agent.get('https://github.com/login')
# Fill out the login form
form = page.form_with(:action => '/session')
form.login = ARGV[0]
form.password = ARGV[1]
page = agent.submit(form)
cuke_tmbundle_forkers.each do |forker|
page = agent.get("https://github.com/inbox/new/#{forker}")
#go to inbox, set subject and body and send!
form = page.form_with(:action => "/inbox")
form["message[subject]"] = "test for cucumber tmbundle network"
form["message[body]"] = "lorem ipsum text for you know foo bar"
agent.submit(form)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment