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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04d8b35b212ee6ca03b20cadc7609dff3721bfe9782ba67e5900464fdf510ee1
4
- data.tar.gz: 6e8514c78339f9512a0712d58e6fcdd0133cfc0b89b2535af23539bd563633dc
3
+ metadata.gz: b0265b488edde83e0a5fdb4450d22202016bc9324f8e921afbccf54ffef1b4c6
4
+ data.tar.gz: d8176f0ff68624cbc4f3397dd4648a608447b5766abb075332cf15277f1c3575
5
5
  SHA512:
6
- metadata.gz: f27b4368499002f2ee5b6c00342c6c13232f8d6066d1b9b12fdc82c948c6af3aa164fb121d24c4057cbbc75db5302929b8dcc1e328997f73581ec6d475be7773
7
- data.tar.gz: 6fd4cd3c9fec357693e29235c4b81725c43713e4629b86309c58be00bfa8ed1d80705cf4bbc681eee4cb72b209d61286315fe6f849620db40856c04ae516c3bc
6
+ metadata.gz: 37bfb1dcece89e90e17a874be2e93445c204eeda3d65c2cd4453ad4d5f12c530d2c110b239c3d38b97b16f375b509bcd95f0a8b0c0e2798977528e2606e4a4ad
7
+ data.tar.gz: 3f920d582d7c7b1f3a1da417ed28d82706e4b2170f0ea0a850bde40d4a421bde47f14e5d62fef943834719b82978e8a2afca4b9741bc25b64bc4ab64a5f399a4
@@ -12,6 +12,6 @@ branches:
12
12
  - master
13
13
 
14
14
  before_install:
15
- - gem update bundler
15
+ - "gem install bundler -v '~> 1.13'"
16
16
 
17
17
  bundler_args: --jobs 7
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:
@@ -16,7 +16,7 @@ RUN cd /tmp && \
16
16
  rm -rf s3cmd-1.6.1*
17
17
 
18
18
  # Upgrade bundler
19
- RUN gem update --no-document && \
19
+ RUN gem install bundler -v '~> 1.13' --no-document && \
20
20
  gem cleanup
21
21
 
22
22
  # Install the bundle
@@ -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).string,
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
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module HashiCorp
3
- VERSION = "0.3.37"
3
+ VERSION = "0.3.38"
4
4
  end
5
5
  end
@@ -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.37
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: 2018-04-16 00:00:00.000000000 Z
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
- rubyforge_project:
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