summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-08-21 12:18:12 -0700
committerGitHub <noreply@github.com>2020-08-21 12:18:12 -0700
commit08ce9e5c47af33114454b3d422575990d15d2a05 (patch)
tree6c0660ce5a4037e78d74100be7f086211201cefd
parentd3e3be2979fe9036cd478857952281540afa36f2 (diff)
parente5cb3198c6ee34032625d8eef16e0710c5c89ed0 (diff)
downloadmixlib-authentication-08ce9e5c47af33114454b3d422575990d15d2a05.tar.gz
Merge pull request #53 from chef/requires
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--Gemfile2
-rw-r--r--Rakefile2
-rw-r--r--lib/mixlib/authentication/digester.rb2
-rw-r--r--lib/mixlib/authentication/signatureverification.rb4
-rw-r--r--lib/mixlib/authentication/signedheaderauth.rb6
-rw-r--r--spec/mixlib/authentication/http_authentication_request_spec.rb4
-rw-r--r--spec/mixlib/authentication/mixlib_authentication_spec.rb10
-rw-r--r--spec/spec_helper.rb2
8 files changed, 16 insertions, 16 deletions
diff --git a/Gemfile b/Gemfile
index b21c475..8786b84 100644
--- a/Gemfile
+++ b/Gemfile
@@ -21,6 +21,6 @@ end
group :debug do
gem "pry"
gem "pry-byebug"
- gem "pry-stack_explorer"
+ gem "pry-stack_explorer", "~> 0.4.0" # pin until we drop ruby < 2.6
gem "rb-readline"
end
diff --git a/Rakefile b/Rakefile
index 0bd0b29..c8140a3 100644
--- a/Rakefile
+++ b/Rakefile
@@ -24,7 +24,7 @@ rescue LoadError
end
begin
- require "yard"
+ require "yard" unless defined?(YARD)
YARD::Rake::YardocTask.new(:docs)
rescue LoadError
puts "yard is not available. bundle install first to make sure all dependencies are installed."
diff --git a/lib/mixlib/authentication/digester.rb b/lib/mixlib/authentication/digester.rb
index c7f424f..a19c414 100644
--- a/lib/mixlib/authentication/digester.rb
+++ b/lib/mixlib/authentication/digester.rb
@@ -17,7 +17,7 @@
#
require_relative "../authentication"
-require "openssl"
+require "openssl" unless defined?(OpenSSL)
module Mixlib
module Authentication
diff --git a/lib/mixlib/authentication/signatureverification.rb b/lib/mixlib/authentication/signatureverification.rb
index 1f58274..1e7a0f5 100644
--- a/lib/mixlib/authentication/signatureverification.rb
+++ b/lib/mixlib/authentication/signatureverification.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require "net/http"
-require "forwardable"
+require "net/http" unless defined?(Net::HTTP)
+require "forwardable" unless defined?(Forwardable)
require_relative "../authentication"
require_relative "http_authentication_request"
require_relative "signedheaderauth"
diff --git a/lib/mixlib/authentication/signedheaderauth.rb b/lib/mixlib/authentication/signedheaderauth.rb
index be34381..c86c295 100644
--- a/lib/mixlib/authentication/signedheaderauth.rb
+++ b/lib/mixlib/authentication/signedheaderauth.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require "time"
-require "base64"
+require "time" unless defined?(Time)
+require "base64" unless defined?(Base64)
require "openssl/digest"
require_relative "../authentication"
require_relative "digester"
@@ -306,7 +306,7 @@ module Mixlib
def do_sign_ssh_agent(rsa_key, string_to_sign)
# First try loading net-ssh as it is an optional dependency.
begin
- require "net/ssh"
+ require "net/ssh" unless defined?(Net::SSH)
rescue LoadError => e
# ???: Since agent mode is explicitly enabled, should we even catch
# this in the first place? Might be cleaner to let the LoadError bubble.
diff --git a/spec/mixlib/authentication/http_authentication_request_spec.rb b/spec/mixlib/authentication/http_authentication_request_spec.rb
index bd265bb..29a134a 100644
--- a/spec/mixlib/authentication/http_authentication_request_spec.rb
+++ b/spec/mixlib/authentication/http_authentication_request_spec.rb
@@ -20,8 +20,8 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_hel
require "mixlib/authentication"
require "mixlib/authentication/http_authentication_request"
-require "ostruct"
-require "pp"
+require "ostruct" unless defined?(OpenStruct)
+require "pp" unless defined?(PP)
describe Mixlib::Authentication::HTTPAuthenticationRequest do
before do
diff --git a/spec/mixlib/authentication/mixlib_authentication_spec.rb b/spec/mixlib/authentication/mixlib_authentication_spec.rb
index 5a17d5c..b679208 100644
--- a/spec/mixlib/authentication/mixlib_authentication_spec.rb
+++ b/spec/mixlib/authentication/mixlib_authentication_spec.rb
@@ -20,13 +20,13 @@
#
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))
-require "rubygems"
+require "rubygems" unless defined?(Gem)
-require "ostruct"
-require "openssl"
+require "ostruct" unless defined?(OpenStruct)
+require "openssl" unless defined?(OpenSSL)
require "mixlib/authentication/signatureverification"
-require "time"
-require "net/ssh"
+require "time" unless defined?(Time)
+require "net/ssh" unless defined?(Net::SSH)
# TODO: should make these regular spec-based mock objects.
class MockRequest
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 4fd27f0..f10ee93 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -19,4 +19,4 @@
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")) # lib in mixlib-authentication
-require "rubygems"
+require "rubygems" unless defined?(Gem)