diff --git a/gather.rb b/gather.rb
index f3bea21..c55cddc 100755
--- a/gather.rb
+++ b/gather.rb
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
+require 'cgi'
$PAGE_BASE = "http://tilde.town/~dzwdz/golf"
$LOCAL_BASE = "/home/dzwdz/public_html/golf"
@@ -16,36 +17,7 @@ def submissions(event)
.filter {|l| not l.end_with? '.hint'}
end
-## mirrors files into public_html/golf/[event name]/mirror/
-def mirror(event)
- all_files(event)
- .each do |path|
- split = path.split('/')
- user = split[2]
- name = split[5]
- `mkdir -p #{$LOCAL_BASE}/#{event}/mirror/#{user}`
- begin
- File.symlink(path, "#{$LOCAL_BASE}/#{event}/mirror/#{user}/#{name}")
- rescue Errno::EEXIST
- end
- end
-end
-
def challenge_page(event)
- # maps participants to their submissions
- p_map = Hash.new []
-
- submissions(event)
- .each do |path|
- user = path.split('/')[2]
- p_map[user] += [path]
- end
-
- # temporary
- p_map["dzwdz1"] = p_map["dzwdz"]
- p_map["dzwdz2"] = p_map["dzwdz"]
- p_map["dzwdz3"] = p_map["dzwdz"]
-
file = File.new("#{$LOCAL_BASE}/#{event}/index.html", 'w')
file.write $HTML_HEAD
@@ -53,32 +25,19 @@ def challenge_page(event)
file.write "
"
file.write "
#{event}
"
file.write File.read("challenges/#{event}/desc.html")
- file.write "how can i join?"
file.write "
"
# solutions
file.write "
"
- p_map.each do
- |user, submissions|
- file.print "
~#{user}
"
- submissions.each do
- |path|
- name = path.split('/')[5]
- file.print "
"
- # todo this has a million vulns
- # also it's a mess
- file.print ""
- file.print "#{name}"
- file.print " (#{File.size path}b)"
- hint = path + '.hint'
- # speaking of messes
- if File.exists? hint
- file.print "hint"
- end
- file.print "
"
+ submissions(event)
+ .each do |path|
+ file.write "