Browse files

New version, first commit.

  • Loading branch information...
1 parent 25654aa commit c275a642be48cf30848cf01d9a3107c0bf44586e @ashbb committed Oct 12, 2008
Showing with 31 additions and 0 deletions.
  1. +30 −0 Countries/ruby_launcher.rb
  2. +1 −0 README.txt
View
30 Countries/ruby_launcher.rb
@@ -0,0 +1,30 @@
+# ruby_launcher.rb
+# usage: ruby ruby_launcher.rb FORPC101-8C
+#
+# NOTE: replace your username and passowrd, line 13 and 14
+
+require 'mechanize'
+
+agent = WWW::Mechanize.new
+
+login_page = agent.get("http://rubylearning.org/class/login/index.php")
+
+login_form = login_page.forms.first
+login_form['username'] = "username"
+login_form['password'] = "password"
+main_page = agent.submit(login_form)
+
+course_link = main_page.links.text(ARGV[0].upcase)
+course_link.shift if course_link.length == 3
+course_page = agent.get(course_link.href)
+
+participants_link = course_page.links.text('Participants')
+participants_page = agent.get(participants_link.href)
+
+show_all_text = participants_page.search("//div[@id='showall']").inner_text
+show_all_link = participants_page.links.text(show_all_text)
+show_all_page = agent.get(show_all_link.href)
+
+open('show_all_page.html', 'w'){|f| f.puts show_all_page.body}
+
+%x(ruby shoes_countries_new.rb)
View
1 README.txt
@@ -10,6 +10,7 @@ Requirement:
Usage:
+- replace your username and passowrd, line 13 and 14 of ruby_launcher.rb
- input the following command line to launch the ruby program (not Shoes app) - ruby_launcher.rb,
with one argument (course name).

0 comments on commit c275a64

Please sign in to comment.