Class: Middleman::HashiCorp::Releases
- Inherits:
-
Object
- Object
- Middleman::HashiCorp::Releases
- Defined in:
- lib/middleman-hashicorp/releases.rb
Defined Under Namespace
Classes: Build
Constant Summary collapse
- RELEASES_URL =
"https://releases.hashicorp.com".freeze
Class Method Summary collapse
Class Method Details
.fetch(product, version) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/middleman-hashicorp/releases.rb', line 8 def self.fetch(product, version) url = "#{RELEASES_URL}/#{product}/#{version}/index.json" r = JSON.parse(open(url).string, create_additions: false, symbolize_names: true, ) # Convert the builds into the following format: # # { # "os" => { # "arch" => "https://download.url" # } # } # {}.tap do |h| r[:builds].each do |b| build = Build.new(*b.values_at(*Build.members)) h[build.os] ||= {} h[build.os][build.arch] = build.url end end end |