diff --git a/website/config.rb b/website/config.rb index d8feeb6f3..464ba1dc4 100644 --- a/website/config.rb +++ b/website/config.rb @@ -1,3 +1,35 @@ +require "net/http" + +raise "BINTRAY_API_KEY must be set." if !ENV["BINTRAY_API_KEY"] +raise "PACKER_VERSION must be set." if !ENV["PACKER_VERSION"] + +#------------------------------------------------------------------------- +# Download the list of Packer downloads +#------------------------------------------------------------------------- + +http = Net::HTTP.new("dl.bintray.com", 80) +req = Net::HTTP::Get.new("/mitchellh/packer") +req.basic_auth "mitchellh", ENV["BINTRAY_API_KEY"] +response = http.request(req) + +$packer_files = {} +response.body.split("\n").each do |line| + next if line !~ /\/mitchellh\/packer\/(#{ENV["PACKER_VERSION"]}.+?)\?/ + filename = $1.to_s + os = filename.split("_")[1] + + $packer_files[os] ||= [] + $packer_files[os] << filename +end + +$packer_files.each do |key, value| + value.sort! +end + +#------------------------------------------------------------------------- +# Configure Middleman +#------------------------------------------------------------------------- + set :css_dir, 'stylesheets' set :js_dir, 'javascripts' set :images_dir, 'images' @@ -13,3 +45,36 @@ configure :build do activate :minify_html activate :minify_javascript end + +#------------------------------------------------------------------------- +# Helpers +#------------------------------------------------------------------------- +helpers do + def download_arch(file) + file.split("_")[2].split(".")[0] + end + + def download_os_human(os) + if os == "darwin" + return "Mac OS X" + elsif os == "freebsd" + return "FreeBSD" + elsif os == "openbsd" + return "OpenBSD" + elsif os == "Linux" + return "Linux" + elsif os == "windows" + return "Windows" + else + return os + end + end + + def download_url(file) + "http://dl.bintray.com/mitchellh/packer/#{file}?direct" + end + + def latest_version + ENV["PACKER_VERSION"] + end +end diff --git a/website/source/downloads.html.erb b/website/source/downloads.html.erb new file mode 100644 index 000000000..c34df8ec4 --- /dev/null +++ b/website/source/downloads.html.erb @@ -0,0 +1,40 @@ +--- +page_title: "Downloads" +--- + +
+
+

Downloads

+ Latest version: <%= latest_version %> +
+
+ +
+
+
+
+

+ Below are all available downloads for the latest version of Packer + (<%= latest_version %>). Please download the proper package for your + operating system and architecture. +

+
+
+ <% $packer_files.each do |os, files| %> +
+
+
+
+

<%= download_os_human(os) %>

+ +
+
+
+
+ <% end %> +
+
diff --git a/website/source/index.html.erb b/website/source/index.html.erb index 1ce0f6e66..17d645121 100644 --- a/website/source/index.html.erb +++ b/website/source/index.html.erb @@ -14,8 +14,9 @@
+
diff --git a/website/source/layouts/layout.erb b/website/source/layouts/layout.erb index d8de5c21e..fdb9d558b 100644 --- a/website/source/layouts/layout.erb +++ b/website/source/layouts/layout.erb @@ -28,7 +28,7 @@ - + diff --git a/website/source/stylesheets/_components.scss b/website/source/stylesheets/_components.scss index 1fc8fb774..f923c1568 100644 --- a/website/source/stylesheets/_components.scss +++ b/website/source/stylesheets/_components.scss @@ -1,3 +1,18 @@ +header .header { + height: 200px; + background: #000000; + + h1 { + margin-bottom: -8px; + margin-top: 60px; + text-transform: uppercase; + } + + span { + font-size: 20px; + } +} + .hero { height: $hero-height; background: #000000 url(/images/hero_image.jpg) no-repeat 35px -40px; @@ -17,7 +32,6 @@ .download-container { background: url(/images/down_arrow.png) no-repeat top left; min-height: 73px; - width: 320px; margin: 0 auto; padding-left: 100px; } @@ -42,6 +56,59 @@ } } +.downloads { + margin-top: 20px; + + .description { + margin-bottom: 20px; + } + + .download { + border-bottom: 1px solid #b2b2b2; + padding-bottom: 15px; + margin-bottom: 15px; + + .details { + padding-left: 95px; + + li { + display: inline-block; + + &:after { + content: " | "; + } + + &:last-child:after { + content: ""; + } + } + + a { + font-size: 22px; + color: darken($green, 15%); + + &:hover { + color: darken($green, 30%); + } + + &:active { + color: darken($green, 50%); + } + } + } + + .icon { + img { + width: 75px; + } + } + + .os-name { + font-size: 40px; + margin-bottom: -3px; + } + } +} .marketting { p {