bard 1.7.0 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a11cf0d4ee1ff435809dbe0e48beb1dcff72f2a4191fa39c40ef8932bbf64915
4
- data.tar.gz: 4861d2109f0cb0d438dd281425865ac8c0496019c8529560464fab55c05b5da7
3
+ metadata.gz: 674739cf14af03776e5f892cb47463decdc1a3a6a493ee4e62dc3528a4fe2c36
4
+ data.tar.gz: 5685ced74cc962121ad634d9290aeba0663373c9db052ca3480d37f29ec8ec1b
5
5
  SHA512:
6
- metadata.gz: 53d527f268f68f7b5a61cae324e583f83c26246bd69f4717a37e10c2e1ae44ca53d7d3b194a60454a82c1471ba8588f1182177dd7994b41c193739889a0d5a36
7
- data.tar.gz: 669b2ae00f5c9983fed2747e1426f48710c5da142b3d43cda7bb0c7c3c160dc9ee52385f606ea65dbf087803733461bf4ce71d15b3bb8ed5373737555dd441a8
6
+ metadata.gz: 734fe59b6c52c355168637b37685bda6a54dc05faf66db0d7758bcb00305a00069056915f433fc5359b36236896a300ac5162632872cc00e71c5bc7d730239de
7
+ data.tar.gz: 924afe38e6cdf1dfa179917856d172c35c1d083571d1dfbfdce53d3c45e8b15950c94c3d6131c123d529005a80ba518ae7ffb420f9eb16fa700999a7cff8e432
data/lib/bard/github.rb CHANGED
@@ -7,6 +7,12 @@ require "bard/ci/retryable"
7
7
  module Bard
8
8
  class Github < Struct.new(:project_name)
9
9
  include CI::Retryable
10
+
11
+ def initialize(project_name, api_key: nil)
12
+ super(project_name)
13
+ @api_key = api_key
14
+ end
15
+
10
16
  def get path, params={}
11
17
  request(path) do |uri|
12
18
  uri.query = URI.encode_www_form(params)
@@ -100,9 +106,9 @@ module Bard
100
106
 
101
107
  private
102
108
 
103
- def github_apikey
104
- @github_apikey ||= begin
105
- raw = `git ls-remote -t git@github.com:botandrose/bard`
109
+ def api_key
110
+ @api_key ||= begin
111
+ raw = `git ls-remote -t git@github.com:botandrosedesign/secrets`
106
112
  raw[/github-apikey\|(.+)$/, 1]
107
113
  end
108
114
  end
@@ -124,7 +130,7 @@ module Bard
124
130
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
125
131
  req = block.call(uri)
126
132
  req["Accept"] = "application/vnd.github+json"
127
- req["Authorization"] = "Bearer #{github_apikey}"
133
+ req["Authorization"] = "Bearer #{api_key}"
128
134
  req["X-GitHub-Api-Version"] = "2022-11-28"
129
135
  http.request(req)
130
136
  end
data/lib/bard/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Bard
2
- VERSION = "1.7.0"
2
+ VERSION = "1.7.2"
3
3
  end
4
4
 
@@ -5,7 +5,7 @@ describe Bard::Github do
5
5
  let(:github) { Bard::Github.new("test-project") }
6
6
 
7
7
  before do
8
- allow(github).to receive(:`).with("git ls-remote -t git@github.com:botandrose/bard").and_return("github-apikey|12345")
8
+ allow(github).to receive(:`).with("git ls-remote -t git@github.com:botandrosedesign/secrets").and_return("github-apikey|12345")
9
9
  end
10
10
 
11
11
  describe "#get" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel