website/www: downloads archive lists old versions

This commit is contained in:
Mitchell Hashimoto 2014-01-10 09:42:05 -08:00
parent 91380c0650
commit 551fe889dc
5 changed files with 91 additions and 24 deletions

View File

@ -1,5 +1,13 @@
require File.expand_path("../helpers/download_helpers", __FILE__)
page "/blog_feed.xml", layout: false page "/blog_feed.xml", layout: false
# Archived download pages
$vagrant_versions.each do |version|
proxy "/download-archive/v#{version}.html", "/download-archive-single.html",
locals: { version: version }, ignore: true
end
set :css_dir, 'stylesheets' set :css_dir, 'stylesheets'
set :js_dir, 'javascripts' set :js_dir, 'javascripts'
set :images_dir, 'images' set :images_dir, 'images'

View File

@ -10,8 +10,12 @@ $vagrant_os_mappings = {
".rpm" => "rpm", ".rpm" => "rpm",
} }
$vagrant_os_order = ["darwin", "windows", "debian", "rpm"]
$vagrant_downloads = {}
$vagrant_versions = []
if ENV["VAGRANT_VERSION"] if ENV["VAGRANT_VERSION"]
puts "Finding downloads for Vagrant: #{ENV["VAGRANT_VERSION"]}" puts "Finding downloads for Vagrant"
raise "BINTRAY_API_KEY must be set." if !ENV["BINTRAY_API_KEY"] raise "BINTRAY_API_KEY must be set." if !ENV["BINTRAY_API_KEY"]
http = Net::HTTP.new("dl.bintray.com", 80) http = Net::HTTP.new("dl.bintray.com", 80)
req = Net::HTTP::Get.new("/mitchellh/vagrant") req = Net::HTTP::Get.new("/mitchellh/vagrant")
@ -21,26 +25,23 @@ if ENV["VAGRANT_VERSION"]
response.body.split("\n").each do |line| response.body.split("\n").each do |line|
next if line !~ /\/mitchellh\/vagrant\/(.+?)'/ next if line !~ /\/mitchellh\/vagrant\/(.+?)'/
filename = $1.to_s filename = $1.to_s
$vagrant_os_mappings.each do |suffix, os|
if !filename.include?(ENV["VAGRANT_VERSION"])
next
end
# Ignore any files that don't appear to have a version in it
next if filename !~ /[-_]?(\d+\.\d+\.\d+[^-_.]*)/
version = Gem::Version.new($1.to_s)
$vagrant_downloads[version] ||= {}
$vagrant_os_mappings.each do |suffix, os|
if filename.end_with?(suffix) if filename.end_with?(suffix)
$vagrant_files[os] ||= [] $vagrant_downloads[version][os] ||= []
$vagrant_files[os] << filename $vagrant_downloads[version][os] << filename
end end
end end
end end
$vagrant_os = $vagrant_files.keys $vagrant_versions = $vagrant_downloads.keys.sort.reverse
$vagrant_files.each do |key, value| $vagrant_versions.each do |v|
value.sort! puts "- Version #{v} found"
puts "Downloads for #{key}:"
value.each do |file|
puts " -- File: #{file}"
end
end end
else else
puts "Not generating downloads." puts "Not generating downloads."
@ -76,6 +77,6 @@ module DownloadHelpers
end end
def latest_version def latest_version
ENV["VAGRANT_VERSION"] $vagrant_versions.first
end end
end end

View File

@ -0,0 +1,51 @@
---
layout: "inner"
sidebar_current: "downloads"
sidebar_template: "downloads"
sidebar_title: "Download"
page_title: "Download Old Vagrant Version"
---
<h2>Old Vagrant Version: <%= version %></h2>
<div class="alert alert-block alert-info">
This is the downloads page for an <em>old</em> version of Vagrant.
The latest version of Vagrant can always be found on the
<a href="/downloads.html">main downloads page</a>.
</div>
<div class="downloads">
<div class="description">
<p>
You can find the SHA256 checksums for this version of Vagrant
<a href="https://dl.bintray.com/mitchellh/vagrant/<%= version %>_SHA256SUMS?direct">here</a>.
</p>
</div>
<% $vagrant_os_order.each do |os| %>
<% downloads = $vagrant_downloads[version] %>
<% if downloads[os] && !downloads[os].empty? %>
<div class="row">
<div class="span8 download">
<div class="icon pull-left"><%= image_tag "/images/icons/icon_#{os}.png" %></div>
<div class="details">
<h2 class="os-name"><%= download_os_human(os) %></h2>
<ul>
<% downloads[os].each do |file| %>
<li><a href="<%= download_url(file) %>"><%= download_arch(file) %></a></li>
<% end %>
</ul>
<div class="clearfix"></div>
</div>
</div>
</div>
<% end %>
<% end %>
<div class="poweredby">
<a href='http://www.bintray.com'>
<img src='http://www.bintray.com/docs/images/poweredByBintray_ColorTransparent.png'>
</a>
</div>
</div>

View File

@ -9,11 +9,13 @@ page_title: "Download Old Versions of Vagrant"
<h2>Old Versions</h2> <h2>Old Versions</h2>
<p> <p>
Old versions of Vagrant can currently be found at the old downloads This webpage lists the older versions of Vagrant that are available for
website here: <a href="http://downloads.vagrantup.com/">http://downloads.vagrantup.com/</a> download. Some even older versions are available from the
<a href="http://downloads.vagrantup.com/">legacy downloads page</a>.
</p> </p>
<p> <ul>
In the future, old versions will be transitioned to the new download <% $vagrant_versions.each do |version| %>
system, so please do not rely on the URLs at that web page. <li><a href="/download-archive/v<%= version.to_s %>.html"><%= version.to_s %></a></li>
</p> <% end %>
</ul>

View File

@ -18,14 +18,17 @@ for packages <a href="https://dl.bintray.com/mitchellh/vagrant/<%= latest_versio
</p> </p>
</div> </div>
<% $vagrant_os.each do |os| %> <% if latest_version %>
<% $vagrant_os_order.each do |os| %>
<% downloads = $vagrant_downloads[latest_version] %>
<% if downloads[os] && !downloads[os].empty? %>
<div class="row"> <div class="row">
<div class="span8 download"> <div class="span8 download">
<div class="icon pull-left"><%= image_tag "/images/icons/icon_#{os}.png" %></div> <div class="icon pull-left"><%= image_tag "/images/icons/icon_#{os}.png" %></div>
<div class="details"> <div class="details">
<h2 class="os-name"><%= download_os_human(os) %></h2> <h2 class="os-name"><%= download_os_human(os) %></h2>
<ul> <ul>
<% $vagrant_files[os].each do |file| %> <% downloads[os].each do |file| %>
<li><a href="<%= download_url(file) %>"><%= download_arch(file) %></a></li> <li><a href="<%= download_url(file) %>"><%= download_arch(file) %></a></li>
<% end %> <% end %>
</ul> </ul>
@ -33,6 +36,8 @@ for packages <a href="https://dl.bintray.com/mitchellh/vagrant/<%= latest_versio
</div> </div>
</div> </div>
</div> </div>
<% end %>
<% end %>
<% end %> <% end %>
<div class="poweredby"> <div class="poweredby">