diff --git a/website/www/config.rb b/website/www/config.rb index 418cff3f0..fa0afaa3c 100644 --- a/website/www/config.rb +++ b/website/www/config.rb @@ -1,5 +1,13 @@ +require File.expand_path("../helpers/download_helpers", __FILE__) + 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 :js_dir, 'javascripts' set :images_dir, 'images' diff --git a/website/www/helpers/download_helpers.rb b/website/www/helpers/download_helpers.rb index 993e34aec..0bf4ea6ca 100644 --- a/website/www/helpers/download_helpers.rb +++ b/website/www/helpers/download_helpers.rb @@ -10,8 +10,12 @@ $vagrant_os_mappings = { ".rpm" => "rpm", } +$vagrant_os_order = ["darwin", "windows", "debian", "rpm"] +$vagrant_downloads = {} +$vagrant_versions = [] + 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"] http = Net::HTTP.new("dl.bintray.com", 80) req = Net::HTTP::Get.new("/mitchellh/vagrant") @@ -21,26 +25,23 @@ if ENV["VAGRANT_VERSION"] response.body.split("\n").each do |line| next if line !~ /\/mitchellh\/vagrant\/(.+?)'/ 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) - $vagrant_files[os] ||= [] - $vagrant_files[os] << filename + $vagrant_downloads[version][os] ||= [] + $vagrant_downloads[version][os] << filename end end end - $vagrant_os = $vagrant_files.keys - $vagrant_files.each do |key, value| - value.sort! - - puts "Downloads for #{key}:" - value.each do |file| - puts " -- File: #{file}" - end + $vagrant_versions = $vagrant_downloads.keys.sort.reverse + $vagrant_versions.each do |v| + puts "- Version #{v} found" end else puts "Not generating downloads." @@ -76,6 +77,6 @@ module DownloadHelpers end def latest_version - ENV["VAGRANT_VERSION"] + $vagrant_versions.first end end diff --git a/website/www/source/download-archive-single.html.erb b/website/www/source/download-archive-single.html.erb new file mode 100644 index 000000000..2547ccedc --- /dev/null +++ b/website/www/source/download-archive-single.html.erb @@ -0,0 +1,51 @@ +--- +layout: "inner" +sidebar_current: "downloads" +sidebar_template: "downloads" +sidebar_title: "Download" +page_title: "Download Old Vagrant Version" +--- + +
+You can find the SHA256 checksums for this version of Vagrant +here. +
+-Old versions of Vagrant can currently be found at the old downloads -website here: http://downloads.vagrantup.com/ +This webpage lists the older versions of Vagrant that are available for +download. Some even older versions are available from the +legacy downloads page.
--In the future, old versions will be transitioned to the new download -system, so please do not rely on the URLs at that web page. -
+