From 550e378dc0461257d9f2f6bda5aa3c081c312b68 Mon Sep 17 00:00:00 2001 From: Christian Williams Date: Tue, 5 Oct 2010 13:50:55 -0700 Subject: [PATCH] Fix download page regen after redesign. --- Rakefile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Rakefile b/Rakefile index e06b9a5..8b574aa 100644 --- a/Rakefile +++ b/Rakefile @@ -91,8 +91,9 @@ jasmine.version_= { FileUtils.cp("src/html/jasmine.css", "lib/jasmine.css") end + downloads_file = 'pages/download.html.md' task :need_pages_submodule do - unless File.exists?('pages/index.html.md') + unless File.exists?(downloads_file) raise "Jasmine pages submodule isn't present. Run git submodule update --init" end end @@ -154,7 +155,6 @@ jasmine.version_= { require 'digest/sha1' download_html = "\n" - download_html += "\n\n" Dir.glob('pages/downloads/*.zip').sort.reverse.each do |f| sha1 = Digest::SHA1.hexdigest File.read(f) @@ -162,19 +162,19 @@ jasmine.version_= { version = /jasmine-standalone-(.*).zip/.match(f)[1] prerelease = /\.rc/.match(f) download_html += prerelease ? "\n" : "\n" - download_html += "\n" - download_html += "\n" - download_html += "\n" - download_html += "\n" - download_html += "\n" + download_html += " \n" + download_html += " \n" + download_html += " \n" + download_html += " \n" + download_html += " \n" download_html += "\n" end - download_html += "
VersionSizeDateSHA1
#{fn.sub(/downloads\//, '')}#{version}#{File.size(f) / 1024}k#{File.mtime(f).strftime("%Y/%m/%d %H:%M:%S %Z")}#{sha1}#{fn.sub(/downloads\//, '')}#{version}#{File.size(f) / 1024}k#{File.mtime(f).strftime("%Y/%m/%d %H:%M:%S %Z")}#{sha1}
\n" + download_html += "" - index_page = File.read('pages/index.html') + downloads_page = File.read(downloads_file) matcher = /.*/m - index_page = index_page.sub(matcher, download_html) - File.open('pages/index.html', 'w') {|f| f.write(index_page)} + downloads_page = downloads_page.sub(matcher, download_html) + File.open(downloads_file, 'w') {|f| f.write(downloads_page)} puts "rewrote that file" end end