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