website: downloads
This commit is contained in:
parent
47ee388dd6
commit
da8b6323ad
|
@ -1,30 +1,30 @@
|
|||
require "net/http"
|
||||
|
||||
$serf_files = {}
|
||||
$serf_os = []
|
||||
$consul_files = {}
|
||||
$consul_os = []
|
||||
|
||||
if ENV["SERF_VERSION"]
|
||||
if ENV["CONSUL_VERSION"]
|
||||
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/serf")
|
||||
req = Net::HTTP::Get.new("/mitchellh/consul")
|
||||
req.basic_auth "mitchellh", ENV["BINTRAY_API_KEY"]
|
||||
response = http.request(req)
|
||||
|
||||
response.body.split("\n").each do |line|
|
||||
next if line !~ /\/mitchellh\/serf\/(#{Regexp.quote(ENV["SERF_VERSION"])}.+?)'/
|
||||
next if line !~ /\/mitchellh\/consul\/(#{Regexp.quote(ENV["CONSUL_VERSION"])}.+?)'/
|
||||
filename = $1.to_s
|
||||
os = filename.split("_")[1]
|
||||
next if os == "SHA256SUMS"
|
||||
|
||||
$serf_files[os] ||= []
|
||||
$serf_files[os] << filename
|
||||
$consul_files[os] ||= []
|
||||
$consul_files[os] << filename
|
||||
end
|
||||
|
||||
$serf_os = ["darwin", "linux", "windows"] & $serf_files.keys
|
||||
$serf_os += $serf_files.keys
|
||||
$serf_os.uniq!
|
||||
$consul_os = ["darwin", "linux", "windows"] & $consul_files.keys
|
||||
$consul_os += $consul_files.keys
|
||||
$consul_os.uniq!
|
||||
|
||||
$serf_files.each do |key, value|
|
||||
$consul_files.each do |key, value|
|
||||
value.sort!
|
||||
end
|
||||
end
|
||||
|
@ -53,10 +53,10 @@ module DownloadHelpers
|
|||
end
|
||||
|
||||
def download_url(file)
|
||||
"https://dl.bintray.com/mitchellh/serf/#{file}"
|
||||
"https://dl.bintray.com/mitchellh/consul/#{file}"
|
||||
end
|
||||
|
||||
def latest_version
|
||||
ENV["SERF_VERSION"]
|
||||
ENV["CONSUL_VERSION"]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,21 +12,21 @@ page_title: "Downloads"
|
|||
<div class="description row">
|
||||
<div class="span8 offset2">
|
||||
<p>
|
||||
Below are all available downloads for the latest version of Serf
|
||||
Below are all available downloads for the latest version of Consul
|
||||
(<%= latest_version %>). Please download the proper package for your
|
||||
operating system and architecture. You can find SHA256 checksums
|
||||
for packages <a href="https://dl.bintray.com/mitchellh/serf/<%= latest_version %>_SHA256SUMS?direct">here</a>.
|
||||
for packages <a href="https://dl.bintray.com/mitchellh/consul/<%= latest_version %>_SHA256SUMS?direct">here</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<% $serf_os.each do |os| %>
|
||||
<% $consul_os.each do |os| %>
|
||||
<div class="row">
|
||||
<div class="span8 offset2 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>
|
||||
<% $serf_files[os].each do |file| %>
|
||||
<% $consul_files[os].each do |file| %>
|
||||
<li><a href="<%= download_url(file) %>"><%= download_arch(file) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue