mirror of
https://github.com/status-im/consul.git
synced 2025-02-16 15:47:21 +00:00
website: downloads
This commit is contained in:
parent
23de3d51ac
commit
be0c35ce64
@ -1,30 +1,30 @@
|
|||||||
require "net/http"
|
require "net/http"
|
||||||
|
|
||||||
$serf_files = {}
|
$consul_files = {}
|
||||||
$serf_os = []
|
$consul_os = []
|
||||||
|
|
||||||
if ENV["SERF_VERSION"]
|
if ENV["CONSUL_VERSION"]
|
||||||
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/serf")
|
req = Net::HTTP::Get.new("/mitchellh/consul")
|
||||||
req.basic_auth "mitchellh", ENV["BINTRAY_API_KEY"]
|
req.basic_auth "mitchellh", ENV["BINTRAY_API_KEY"]
|
||||||
response = http.request(req)
|
response = http.request(req)
|
||||||
|
|
||||||
response.body.split("\n").each do |line|
|
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
|
filename = $1.to_s
|
||||||
os = filename.split("_")[1]
|
os = filename.split("_")[1]
|
||||||
next if os == "SHA256SUMS"
|
next if os == "SHA256SUMS"
|
||||||
|
|
||||||
$serf_files[os] ||= []
|
$consul_files[os] ||= []
|
||||||
$serf_files[os] << filename
|
$consul_files[os] << filename
|
||||||
end
|
end
|
||||||
|
|
||||||
$serf_os = ["darwin", "linux", "windows"] & $serf_files.keys
|
$consul_os = ["darwin", "linux", "windows"] & $consul_files.keys
|
||||||
$serf_os += $serf_files.keys
|
$consul_os += $consul_files.keys
|
||||||
$serf_os.uniq!
|
$consul_os.uniq!
|
||||||
|
|
||||||
$serf_files.each do |key, value|
|
$consul_files.each do |key, value|
|
||||||
value.sort!
|
value.sort!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -53,10 +53,10 @@ module DownloadHelpers
|
|||||||
end
|
end
|
||||||
|
|
||||||
def download_url(file)
|
def download_url(file)
|
||||||
"https://dl.bintray.com/mitchellh/serf/#{file}"
|
"https://dl.bintray.com/mitchellh/consul/#{file}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def latest_version
|
def latest_version
|
||||||
ENV["SERF_VERSION"]
|
ENV["CONSUL_VERSION"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -12,21 +12,21 @@ page_title: "Downloads"
|
|||||||
<div class="description row">
|
<div class="description row">
|
||||||
<div class="span8 offset2">
|
<div class="span8 offset2">
|
||||||
<p>
|
<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
|
(<%= latest_version %>). Please download the proper package for your
|
||||||
operating system and architecture. You can find SHA256 checksums
|
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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% $serf_os.each do |os| %>
|
<% $consul_os.each do |os| %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span8 offset2 download">
|
<div class="span8 offset2 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>
|
||||||
<% $serf_files[os].each do |file| %>
|
<% $consul_files[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>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user