Skip to content

Commit a540088

Browse files
authored
Deprecate unnecessary constant in GitHubMetadata::Client (#239)
Merge pull request 239
1 parent f0635ef commit a540088

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ on:
1010

1111
jobs:
1212
ci:
13-
name: 'Ruby ${{ matrix.ruby_version }}'
14-
runs-on: '${{ matrix.os }}'
13+
name: 'Ruby: ${{ matrix.ruby_version }} • Faraday: ~> ${{ matrix.faraday_version }}'
14+
runs-on: ${{ matrix.os }}
15+
env:
16+
FARADAY_VERSION: ${{ matrix.faraday_version }}
1517
strategy:
1618
fail-fast: false
1719
matrix:
@@ -20,6 +22,9 @@ jobs:
2022
- '3.0'
2123
- '3.1'
2224
- '3.2'
25+
faraday_version:
26+
- '1.0'
27+
- '2.0'
2328
os:
2429
- ubuntu-latest
2530
steps:

lib/jekyll-github-metadata/client.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,20 @@ def method_missing(method_name, *args, &block)
6868
end
6969
end
7070

71-
# NOTE: Faraday's error classes has been promoted to under Faraday module from v1.0.0.
72-
# This patch aims to prevent on locking specific version of Faraday.
71+
# NOTE: Faraday's error classes have been simplified from v1.0.0.
72+
#
73+
# In older versions, both `Faraday::Error::ConnectionFailed` and `Faraday::ConnectionFailed`
74+
# were valid and equivalent to each other.
75+
# From v1.0.0 onwards, `Faraday::Error::ConnectionFailed` no longer exists.
76+
#
77+
# TODO: Remove in v2.0 of this plugin.
7378
FARADAY_FAILED_CONNECTION =
7479
begin
7580
Faraday::Error::ConnectionFailed
7681
rescue NameError
7782
Faraday::ConnectionFailed
7883
end
84+
deprecate_constant :FARADAY_FAILED_CONNECTION
7985

8086
def save_from_errors(default = false)
8187
unless internet_connected?
@@ -86,7 +92,7 @@ def save_from_errors(default = false)
8692
yield @client
8793
rescue Octokit::Unauthorized
8894
raise BadCredentialsError, "The GitHub API credentials you provided aren't valid."
89-
rescue FARADAY_FAILED_CONNECTION, Octokit::TooManyRequests => e
95+
rescue Faraday::ConnectionFailed, Octokit::TooManyRequests => e
9096
GitHubMetadata.log :warn, e.message
9197
default
9298
rescue Octokit::NotFound

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy