From c7600f987e8e5a8a33919526d7fa522fef9c7d4b Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Tue, 14 May 2019 20:21:27 -0700 Subject: Fix chef-config requires lines does the same fixing of require_relative and manual idempotency checking that has been applied to the chef gem Signed-off-by: Lamont Granquist --- chef-config/lib/chef-config/config.rb | 26 +++++++++++----------- chef-config/lib/chef-config/exceptions.rb | 4 ++-- chef-config/lib/chef-config/fips.rb | 2 +- chef-config/lib/chef-config/mixin/credentials.rb | 2 +- chef-config/lib/chef-config/mixin/dot_d.rb | 2 +- chef-config/lib/chef-config/path_helper.rb | 6 ++--- .../lib/chef-config/workstation_config_loader.rb | 14 ++++++------ 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb index 910f0e024d..72b456d848 100644 --- a/chef-config/lib/chef-config/config.rb +++ b/chef-config/lib/chef-config/config.rb @@ -19,19 +19,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -require "mixlib/config" -require "pathname" - -require "chef-config/fips" -require "chef-config/logger" -require "chef-config/windows" -require "chef-config/path_helper" -require "chef-config/mixin/fuzzy_hostname_matcher" - -require "mixlib/shellout" -require "uri" -require "addressable/uri" -require "openssl" +require "mixlib/config" unless defined?(Mixlib::Config) +require "pathname" unless defined?(Pathname) + +require_relative "fips" +require_relative "logger" +require_relative "windows" +require_relative "path_helper" +require_relative "mixin/fuzzy_hostname_matcher" + +require "mixlib/shellout" unless defined?(Mixlib::ShellOut) +require "uri" unless defined?(URI) +require "addressable/uri" unless defined?(Addressable::URI) +require "openssl" unless defined?(OpenSSL) require "yaml" module ChefConfig diff --git a/chef-config/lib/chef-config/exceptions.rb b/chef-config/lib/chef-config/exceptions.rb index 23fd28f9c8..86d34374ab 100644 --- a/chef-config/lib/chef-config/exceptions.rb +++ b/chef-config/lib/chef-config/exceptions.rb @@ -15,8 +15,8 @@ # limitations under the License. # -require "chef-config/windows" -require "chef-config/logger" +require_relative "windows" +require_relative "logger" module ChefConfig diff --git a/chef-config/lib/chef-config/fips.rb b/chef-config/lib/chef-config/fips.rb index 623ce87686..4c365301d5 100644 --- a/chef-config/lib/chef-config/fips.rb +++ b/chef-config/lib/chef-config/fips.rb @@ -21,7 +21,7 @@ module ChefConfig def self.fips? if ChefConfig.windows? begin - require "win32/registry" + require "win32/registry" unless defined?(Win32::Registry) rescue LoadError return false end diff --git a/chef-config/lib/chef-config/mixin/credentials.rb b/chef-config/lib/chef-config/mixin/credentials.rb index 0a7ca356c8..5b0078d1cc 100644 --- a/chef-config/lib/chef-config/mixin/credentials.rb +++ b/chef-config/lib/chef-config/mixin/credentials.rb @@ -16,7 +16,7 @@ # require "tomlrb" -require "chef-config/path_helper" +require_relative "../path_helper" module ChefConfig module Mixin diff --git a/chef-config/lib/chef-config/mixin/dot_d.rb b/chef-config/lib/chef-config/mixin/dot_d.rb index 4c9c998908..3ccbfe19bb 100644 --- a/chef-config/lib/chef-config/mixin/dot_d.rb +++ b/chef-config/lib/chef-config/mixin/dot_d.rb @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require "chef-config/path_helper" +require_relative "../path_helper" module ChefConfig module Mixin diff --git a/chef-config/lib/chef-config/path_helper.rb b/chef-config/lib/chef-config/path_helper.rb index de71d483d5..7e0f4361ce 100644 --- a/chef-config/lib/chef-config/path_helper.rb +++ b/chef-config/lib/chef-config/path_helper.rb @@ -16,9 +16,9 @@ # limitations under the License. # -require "chef-config/windows" -require "chef-config/logger" -require "chef-config/exceptions" +require_relative "windows" +require_relative "logger" +require_relative "exceptions" module ChefConfig class PathHelper diff --git a/chef-config/lib/chef-config/workstation_config_loader.rb b/chef-config/lib/chef-config/workstation_config_loader.rb index af0c438ca1..a3aa40433a 100644 --- a/chef-config/lib/chef-config/workstation_config_loader.rb +++ b/chef-config/lib/chef-config/workstation_config_loader.rb @@ -16,13 +16,13 @@ # limitations under the License. # -require "chef-config/config" -require "chef-config/exceptions" -require "chef-config/logger" -require "chef-config/path_helper" -require "chef-config/windows" -require "chef-config/mixin/dot_d" -require "chef-config/mixin/credentials" +require_relative "config" +require_relative "exceptions" +require_relative "logger" +require_relative "path_helper" +require_relative "windows" +require_relative "mixin/dot_d" +require_relative "mixin/credentials" module ChefConfig class WorkstationConfigLoader -- cgit v1.2.1