middleman-hashicorp 0.3.37 → 0.3.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +8 -0
- data/docker/Dockerfile +1 -1
- data/lib/middleman-hashicorp/extension.rb +7 -0
- data/lib/middleman-hashicorp/releases.rb +18 -1
- data/lib/middleman-hashicorp/version.rb +1 -1
- data/spec/unit/helper_spec.rb +14 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0265b488edde83e0a5fdb4450d22202016bc9324f8e921afbccf54ffef1b4c6
|
4
|
+
data.tar.gz: d8176f0ff68624cbc4f3397dd4648a608447b5766abb075332cf15277f1c3575
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37bfb1dcece89e90e17a874be2e93445c204eeda3d65c2cd4453ad4d5f12c530d2c110b239c3d38b97b16f375b509bcd95f0a8b0c0e2798977528e2606e4a4ad
|
7
|
+
data.tar.gz: 3f920d582d7c7b1f3a1da417ed28d82706e4b2170f0ea0a850bde40d4a421bde47f14e5d62fef943834719b82978e8a2afca4b9741bc25b64bc4ab64a5f399a4
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
A wrapper around [Middleman][] for HashiCorp's customizations.
|
4
4
|
|
5
|
+
## Table of Contents
|
6
|
+
|
7
|
+
- [Installation](#installation)
|
8
|
+
- [Usage](#usage)
|
9
|
+
- [Customizations](#customizations)
|
10
|
+
- [Publishing a new Release](#publishing-a-new-release)
|
11
|
+
- [Contributing](#contributing)
|
12
|
+
|
5
13
|
## Installation
|
6
14
|
|
7
15
|
Add this line to the Gemfile:
|
data/docker/Dockerfile
CHANGED
@@ -272,6 +272,13 @@ class Middleman::HashiCorpExtension < ::Middleman::Extension
|
|
272
272
|
f = File.expand_path("../partials/_enterprise-alert.html.erb", __FILE__)
|
273
273
|
render_individual_file(f, variables, { template_body: File.read(f) })
|
274
274
|
end
|
275
|
+
|
276
|
+
#
|
277
|
+
# Query the API to get the latest version of a given terraform provider
|
278
|
+
#
|
279
|
+
def latest_provider_version(name)
|
280
|
+
Middleman::HashiCorp::Releases.fetch_latest_version("terraform-provider-#{name}")[:version]
|
281
|
+
end
|
275
282
|
end
|
276
283
|
|
277
284
|
#
|
@@ -7,7 +7,7 @@ class Middleman::HashiCorp::Releases
|
|
7
7
|
|
8
8
|
def self.fetch(product, version)
|
9
9
|
url = "#{RELEASES_URL}/#{product}/#{version}/index.json"
|
10
|
-
r = JSON.parse(open(url).
|
10
|
+
r = JSON.parse(open(url).read,
|
11
11
|
create_additions: false,
|
12
12
|
symbolize_names: true,
|
13
13
|
)
|
@@ -29,4 +29,21 @@ class Middleman::HashiCorp::Releases
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# Gets only the most recently released version data for a given product
|
35
|
+
#
|
36
|
+
def self.fetch_latest_version(product)
|
37
|
+
url = "#{RELEASES_URL}/#{product}/index.json"
|
38
|
+
res = JSON.parse(open(url).read,
|
39
|
+
create_additions: false,
|
40
|
+
symbolize_names: true,
|
41
|
+
)
|
42
|
+
versions = res[:versions]
|
43
|
+
|
44
|
+
# Releases are formatted as an object rather than an array in the JSON
|
45
|
+
# structure, so we need to convert to an array then sort by version to
|
46
|
+
# get the latest. We then return all info for that version.
|
47
|
+
versions[versions.keys.sort_by(&Gem::Version.method(:new)).last]
|
48
|
+
end
|
32
49
|
end
|
data/spec/unit/helper_spec.rb
CHANGED
@@ -121,4 +121,18 @@ class Middleman::HashiCorpExtension
|
|
121
121
|
expect(@instance.app.pretty_os("hashicorplinux")).to eq("Hashicorplinux")
|
122
122
|
end
|
123
123
|
end
|
124
|
+
|
125
|
+
describe "#latest_provider_version" do
|
126
|
+
before(:each) do
|
127
|
+
app = middleman_app
|
128
|
+
@instance = Middleman::HashiCorpExtension.new(app,
|
129
|
+
releases_enabled: false,
|
130
|
+
)
|
131
|
+
@instance.app = app
|
132
|
+
end
|
133
|
+
|
134
|
+
it "returns the latest provider version for a given provider" do
|
135
|
+
expect(@instance.app.latest_provider_version("template")).to match(/\d+\.\d+\.\d+/)
|
136
|
+
end
|
137
|
+
end
|
124
138
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-hashicorp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Vargo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman
|
@@ -238,8 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
238
|
- !ruby/object:Gem::Version
|
239
239
|
version: '0'
|
240
240
|
requirements: []
|
241
|
-
|
242
|
-
rubygems_version: 2.7.6
|
241
|
+
rubygems_version: 3.0.3
|
243
242
|
signing_key:
|
244
243
|
specification_version: 4
|
245
244
|
summary: A series of helpers for consistency among HashiCorp's middleman sites
|