openstax_aws 1.2.0 → 1.3.0

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: eb329933135fb800a09d8883d181b3a44fa0ff97f58d79757c0710d35f30594c
4
- data.tar.gz: ecf61c1aba906cfb3b7a848c42bffac57193864c138eaa84c8592c697be589c4
3
+ metadata.gz: b1bb7df27bc9eb147fc4dccf7969fbcfaab379a615adcb2e6a255bc1951f72ca
4
+ data.tar.gz: dfa73e4d1aa3b1973678aa4fbcff0588e6990ec59a74b1ffad4758820b08600c
5
5
  SHA512:
6
- metadata.gz: 903288c5e8e78ab5c94e660bbd8657ed9357002fb82a2cdc22f398284d3800daad6c478d669d4072e3c8f74d665aa0ed2fe27687c02e154e582b80fec4ffd97c
7
- data.tar.gz: 75dae33c89bb17c0ebf211450551003158a85ee1228c877f17cad075f596fe5e82bb5562029ed2d746a4f9ea9cba9613d9e9f9cfbcd7e1ba466bc92178a6825a
6
+ metadata.gz: 27c7c692f885a25aed594990cd52478754a53a87b3f5c473e8815777070c809b8cead54937c9dfbb6f9f0d629c3169916e17b747ca92db1e3a9b300d6e3db0dd
7
+ data.tar.gz: 40a6e67cd196f2870d9f8c54873641719c7c799ddf7778665c730558de93eef2758ca940a667110a07aa189f755787940596e7865eeb778ec6b83ec4be109cc2
@@ -8,11 +8,20 @@ module OpenStax::Aws
8
8
  ::Git.ls_remote("https://github.com/#{org_slash_repo}")["branches"][branch][:sha]
9
9
  end
10
10
 
11
- def self.file_content_at_sha(org_slash_repo:, sha:, path:)
12
- location = "https://raw.githubusercontent.com/#{org_slash_repo}/#{sha}/#{path}"
13
- file = open(location)
14
- file.read
11
+ def self.file_content_at_sha(org_slash_repo:, sha:, path:, github_token: nil )
12
+ if github_token.blank?
13
+ location = "https://raw.githubusercontent.com/#{org_slash_repo}/#{sha}/#{path}"
14
+ file = open(location)
15
+ file.read
16
+ else
17
+ uri = URI("https://raw.githubusercontent.com/#{org_slash_repo}/#{sha}/#{path}")
18
+ Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
19
+ request = Net::HTTP::Get.new uri.request_uri
20
+ request.basic_auth 'token', github_token
21
+ response = http.request request
22
+ response.body
23
+ end
24
+ end
15
25
  end
16
-
17
26
  end
18
27
  end
@@ -39,6 +39,7 @@ module OpenStax::Aws
39
39
  org_slash_repo: attributes[:org_slash_repo],
40
40
  sha: attributes[:sha],
41
41
  path: attributes[:path],
42
+ github_token: attributes[:github_token],
42
43
  format: attributes[:format].to_sym,
43
44
  top_key: attributes[:top_key].to_sym,
44
45
  preparser: attributes[:preparser]
@@ -13,11 +13,12 @@ module OpenStax::Aws
13
13
  new(content: content, format: format, top_key: top_key, preparser: preparser)
14
14
  end
15
15
 
16
- def self.from_git(org_slash_repo:, sha:, path:, format:, top_key: nil, preparser: nil)
16
+ def self.from_git(org_slash_repo:, sha:, path:, github_token: nil, format:, top_key: nil, preparser: nil)
17
17
  content = OpenStax::Aws::GitHelper.file_content_at_sha(
18
18
  org_slash_repo: org_slash_repo,
19
19
  sha: sha,
20
- path: path
20
+ path: path,
21
+ github_token: github_token
21
22
  )
22
23
  new(content: content, format: format, top_key: top_key, preparser: preparser)
23
24
  end
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Aws
3
- VERSION = "1.2.0"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-12 00:00:00.000000000 Z
11
+ date: 2021-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-autoscaling
@@ -342,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
342
  - !ruby/object:Gem::Version
343
343
  version: '0'
344
344
  requirements: []
345
- rubygems_version: 3.0.3
345
+ rubygems_version: 3.2.7
346
346
  signing_key:
347
347
  specification_version: 4
348
348
  summary: openstax IaC