aboutsummaryrefslogtreecommitdiff
path: root/example.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'example.cgi')
-rwxr-xr-xexample.cgi31
1 files changed, 20 insertions, 11 deletions
diff --git a/example.cgi b/example.cgi
index 4c7a970..388fa87 100755
--- a/example.cgi
+++ b/example.cgi
@@ -26,23 +26,32 @@ def _(string)
end
require "config"
-source = nil
-EXAMPLES.each{|poll|
- source = poll[:url] if $cgi["poll"] == poll[:url]
+poll = nil
+EXAMPLES.each{|p|
+ poll = p if $cgi["poll"] == p[:url]
}
-raise "Example not found" unless source
-target = "#{source}_#{Time.now.to_i}"
+raise "Example not found" unless poll
-while (File.exists?(target))
- target += "I"
+targeturl = poll[:url]
+
+if poll[:new_environment]
+ targeturl += "_#{Time.now.to_i}"
+
+ while (File.exists?(targeturl))
+ targeturl += "I"
+ end
+ VCS.branch(poll[:url],targeturl)
+end
+
+if poll[:revno]
+ Dir.chdir(targeturl)
+ VCS.revert(poll[:revno])
+ Dir.chdir("..")
end
-VCS.branch(source,target)
-`rm #{target}/.htaccess`
-`rm #{target}/.htdigest`
$cgi.out({
"status" => "REDIRECT",
"Cache-Control" => "no-cache",
- "Location" => SITEURL + target
+ "Location" => SITEURL + targeturl
}){""}