Created
January 23, 2013 23:25
-
-
Save jhenry/4615682 to your computer and use it in GitHub Desktop.
Quick and dirty Bb batch file creator is quick and dirty.
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
#!/usr/bin/env ruby | |
id_prefix = "ETS_HELPLINE" | |
user_list = "jhenry,bbaggin,fbaggin".split(',') | |
course_title_suffix = "001: ETS Helpline Sandbox Space" | |
t = Time.now() | |
datestamp = t.strftime("%Y%m%d") | |
users = Hash.new | |
user_list.each do |u| | |
users[u] = Hash.new | |
users[u]["user"] = u.upcase | |
users[u]["course_id"] = id_prefix + "_" + users[u]["user"] + "_" + datestamp | |
users[u]["course_title"] = users[u]["user"] + course_title_suffix | |
# puts course_id + "," + course_title | |
end | |
course_file = File.open("bb_batch_courses_" + datestamp + ".txt", "w") | |
users.each do |uid, crs| | |
course_file.write(crs["course_id"] + "," + crs["course_title"] + "\n") | |
end | |
enroll_file = File.open("bb_batch_enroll_" + datestamp + ".txt", "w") | |
users.each do |uid,crs| | |
enroll_file.write(crs["course_id"] + "," + crs["user"] + ",P\n") | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment