diff --git a/.travis.yml b/.travis.yml index fec241f..866827a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,9 +10,11 @@ rvm: matrix: include: - rvm: *latest_ruby - env: JEKYLL_VERSION=3.7.0 + env: JEKYLL_VERSION=4.0 FARADAY_VERSION=0.17 - rvm: *latest_ruby - env: JEKYLL_VERSION=4.0.0.pre.alpha1 + env: JEKYLL_VERSION=3.7 FARADAY_VERSION=0.17 + - rvm: *latest_ruby + env: JEKYLL_VERSION=3.7 FARADAY_VERSION=1.0 branches: only: - master diff --git a/Gemfile b/Gemfile index 5562f2c..81d7b3c 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,7 @@ source "https://rubygems.org" gemspec +gem "faraday", "~> #{ENV["FARADAY_VERSION"]}" if ENV["FARADAY_VERSION"] gem "jekyll", "~> #{ENV["JEKYLL_VERSION"]}" if ENV["JEKYLL_VERSION"] group :test do diff --git a/appveyor.yml b/appveyor.yml index 667cc3f..06ec0e9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,10 +9,17 @@ build: off environment: matrix: - RUBY_FOLDER_VER: "26" - JEKYLL_VERSION: "3.7.0" + JEKYLL_VERSION: "4.0" + FARADAY_VERSION: "1.0" - RUBY_FOLDER_VER: "26" - JEKYLL_VERSION: "4.0.0.pre.alpha1" + JEKYLL_VERSION: "4.0" + FARADAY_VERSION: "0.17" - RUBY_FOLDER_VER: "26" + JEKYLL_VERSION: "3.7" + FARADAY_VERSION: "1.0" + - RUBY_FOLDER_VER: "26" + JEKYLL_VERSION: "3.7" + FARADAY_VERSION: "0.17" - RUBY_FOLDER_VER: "25" - RUBY_FOLDER_VER: "24" - RUBY_FOLDER_VER: "23" diff --git a/lib/jekyll-github-metadata/client.rb b/lib/jekyll-github-metadata/client.rb index d2a6aa9..fca7c7a 100644 --- a/lib/jekyll-github-metadata/client.rb +++ b/lib/jekyll-github-metadata/client.rb @@ -68,6 +68,15 @@ def method_missing(method_name, *args, &block) end end + # NOTE: Faraday's error classes has been promoted to under Faraday module from v1.0.0. + # This patch aims to prevent on locking specific version of Faraday. + FARADAY_FAILED_CONNECTION = + begin + Faraday::Error::ConnectionFailed + rescue NameError + Faraday::ConnectionFailed + end + def save_from_errors(default = false) unless internet_connected? GitHubMetadata.log :warn, "No internet connection. GitHub metadata may be missing or incorrect." @@ -77,7 +86,7 @@ def save_from_errors(default = false) yield @client rescue Octokit::Unauthorized raise BadCredentialsError, "The GitHub API credentials you provided aren't valid." - rescue Faraday::Error::ConnectionFailed, Octokit::TooManyRequests => e + rescue FARADAY_FAILED_CONNECTION, Octokit::TooManyRequests => e GitHubMetadata.log :warn, e.message default rescue Octokit::NotFound