buildkit 1.4.2 → 1.4.6

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: cb6ca6eafcc3ad71c019207e36894e60ee31b31053ec2e3aee60930a5d6998b0
4
- data.tar.gz: 9eb250b35103fad340404e0b08ece58be85e76158c8ece673cc9e8d733654374
3
+ metadata.gz: 03b8e45ebac5e4d266640db473fa71aba8cb6c9a819b5e760c6e728053294463
4
+ data.tar.gz: 5f37ba01f369f0e679ed389f7d1cdf6c79151a01d4c74f2a23b51d46a864963b
5
5
  SHA512:
6
- metadata.gz: fd6916b102128b7bd3d6b0627d9f57462a14c565811732d56137691faf96778078536c1011ef3a633c06b499daf0711a9ea3edff4bd7d6689c9342f33ac98cc0
7
- data.tar.gz: e5caef77cd0cb5016a7794b040445562456daab5b29a3f344598fe04345d47e259e674a6b3ff0964d22e6dc5e89958004cb6a4dccc1695caefcb9e2b3228cc0c
6
+ metadata.gz: 8225bf1b1508e2ac4d995f6c7e321c5495022441befe47934d3530f88d358073eb25a9779a850d22af0875f327d18fd06e4ffaf8f3c954f3ef14951023a11356
7
+ data.tar.gz: 6d4f3ab03f90c4f1314288454f377aaaea7bdb119ae6be91b1f20ed79679a0e10f152f9ce51a8e68f6988dec2f917b34ef1cd0a41dfddcabcd4cd7bcce68cfe4
@@ -3,19 +3,16 @@ name: Test Buildkit Gem
3
3
 
4
4
  jobs:
5
5
  build:
6
- runs-on: ubuntu-20.04
6
+ runs-on: ubuntu-latest
7
7
  strategy:
8
8
  matrix:
9
- ruby: [ '2.5', '2.6', '2.7' ]
9
+ ruby: [ '2.5', '2.6', '2.7', '3.0', '3.1' ]
10
10
  name: Ruby ${{ matrix.ruby }}
11
11
  steps:
12
12
  - uses: actions/checkout@v2
13
- - uses: actions/setup-ruby@v1
13
+ - uses: ruby/setup-ruby@v1
14
14
  with:
15
15
  ruby-version: ${{ matrix.ruby }}
16
- - name: bundle install
17
- run: |
18
- gem install bundler
19
- bundle install --jobs 4 --retry 3
16
+ bundler-cache: true # 'bundle install' and cache
20
17
  - name: Run rspec
21
18
  run: 'bundle exec rspec spec'
data/Gemfile CHANGED
@@ -4,12 +4,12 @@ source 'https://rubygems.org'
4
4
 
5
5
  gem 'byebug'
6
6
  gem 'rake'
7
- gem 'rubocop'
8
7
  gem 'yard'
9
8
 
10
9
  group :test do
11
10
  gem 'rspec', '~> 3.2'
12
- gem 'vcr', '~> 2.9', github: 'vcr/vcr', branch: 'master', ref: '480304be6d73803e6c4a0eb21a4ab4091da558d8'
11
+ gem 'rubocop', '~> 0.81.0'
12
+ gem 'vcr', '~> 3.0'
13
13
  end
14
14
 
15
15
  gemspec
data/buildkit.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ['lib']
21
21
 
22
- spec.metadata['allowed_push_host'] = "https://rubygems.org"
22
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
23
23
 
24
24
  spec.required_ruby_version = '>= 2.3'
25
25
 
@@ -147,10 +147,12 @@ module Buildkit
147
147
 
148
148
  response.concat @last_response.data
149
149
 
150
+ break if @last_response.headers[:link].nil?
150
151
  link_header = parse_link_header(@last_response.headers[:link])
151
152
  break if link_header[:next].nil?
152
153
 
153
- path = next_page(link_header[:next])
154
+ unescaped_next = CGI.unescape(link_header[:next])
155
+ path = next_page(unescaped_next)
154
156
  end
155
157
  response
156
158
  end
@@ -168,7 +170,11 @@ module Buildkit
168
170
  http.headers[:accept] = 'application/json'
169
171
  http.headers[:content_type] = 'application/json'
170
172
  http.headers[:user_agent] = "Buildkit v#{Buildkit::VERSION}"
171
- http.authorization 'Bearer', @token
173
+ if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new("1.7.1")
174
+ http.request :authorization, 'Bearer', @token
175
+ else
176
+ http.authorization 'Bearer', @token
177
+ end
172
178
  end
173
179
  end
174
180
 
@@ -89,26 +89,31 @@ module Buildkit
89
89
  def response_error_summary
90
90
  return nil unless data.is_a?(Hash) && !Array(data[:errors]).empty?
91
91
 
92
- summary = "\nError summary:\n"
93
- summary << data[:errors].map do |hash|
92
+ errors = data[:errors].map do |hash|
94
93
  hash.map { |k, v| " #{k}: #{v}" }
95
- end.join("\n")
94
+ end
96
95
 
97
- summary
96
+ <<~MSG.chomp
97
+ Error summary:
98
+ #{errors.join("\n")}
99
+ MSG
98
100
  end
99
101
 
100
102
  def build_error_message
101
103
  return nil if @response.nil?
102
104
 
103
- message = +"#{@response[:method].to_s.upcase} #{redact_url(@response[:url].to_s)}: #{@response[:status]} - "
104
- message << "#{response_message}#{response_error}#{response_error_summary}"
105
- message << " // See: #{documentation_url}" unless documentation_url.nil?
106
- message
105
+ documentation_text = ''
106
+ documentation_text = "// See: #{documentation_url}" if documentation_url
107
+
108
+ <<~MSG.strip
109
+ #{@response[:method].to_s.upcase} #{redact_url(@response[:url].to_s)}: #{@response[:status]} - #{response_message}#{response_error}#{response_error_summary}
110
+ #{documentation_text}
111
+ MSG
107
112
  end
108
113
 
109
114
  def redact_url(url_string)
110
115
  %w[client_secret access_token].each do |token|
111
- url_string.gsub!(/#{token}=\S+/, "#{token}=(redacted)") if url_string.include? token
116
+ url_string = url_string.gsub(/#{token}=\S+/, "#{token}=(redacted)") if url_string.include? token
112
117
  end
113
118
  url_string
114
119
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Buildkit
4
- VERSION = '1.4.2'
4
+ VERSION = '1.4.6'
5
5
  end
data/lib/buildkit.rb CHANGED
@@ -4,7 +4,10 @@ require 'buildkit/version'
4
4
  require 'buildkit/client'
5
5
 
6
6
  module Buildkit
7
- def self.new(*args)
8
- Client.new(*args)
7
+ class << self
8
+ def new(*args)
9
+ Client.new(*args)
10
+ end
11
+ ruby2_keywords :new if respond_to?(:ruby2_keywords, true)
9
12
  end
10
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-03 00:00:00.000000000 Z
11
+ date: 2022-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sawyer
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubygems_version: 3.0.3
93
+ rubygems_version: 3.2.20
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: Ruby toolkit for working with the Buildkite API