diff options
author | mwrock <matt@mattwrock.com> | 2020-09-04 18:46:27 -0700 |
---|---|---|
committer | mwrock <matt@mattwrock.com> | 2020-09-08 14:46:36 -0700 |
commit | 41ae92bd5070b450e04f02ae9a1d30987d14bb93 (patch) | |
tree | 952399197c5344e29a648560fda242ef77a7dd7e /lib/chef/mixin | |
parent | 313afa345a0d19019218807a16bf6fdd6447a87b (diff) | |
download | chef-41ae92bd5070b450e04f02ae9a1d30987d14bb93.tar.gz |
use autoloading for many required gems
Signed-off-by: mwrock <matt@mattwrock.com>
Diffstat (limited to 'lib/chef/mixin')
-rw-r--r-- | lib/chef/mixin/openssl_helper.rb | 5 | ||||
-rw-r--r-- | lib/chef/mixin/template.rb | 4 | ||||
-rw-r--r-- | lib/chef/mixin/uris.rb | 4 |
3 files changed, 5 insertions, 8 deletions
diff --git a/lib/chef/mixin/openssl_helper.rb b/lib/chef/mixin/openssl_helper.rb index db422175bb..1d50523df8 100644 --- a/lib/chef/mixin/openssl_helper.rb +++ b/lib/chef/mixin/openssl_helper.rb @@ -14,15 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # +autoload :OpenSSL, "openssl" class Chef module Mixin # various helpers for use with openssl. Currently used by the openssl_* resources module OpenSSLHelper - def self.included(_base) - require "openssl" unless defined?(::OpenSSL) - end - # determine the key filename from the cert filename # @param [String] cert_filename the path to the certfile # @return [String] the path to the keyfile diff --git a/lib/chef/mixin/template.rb b/lib/chef/mixin/template.rb index d72bfe9e3a..a369cae9e5 100644 --- a/lib/chef/mixin/template.rb +++ b/lib/chef/mixin/template.rb @@ -16,8 +16,8 @@ # limitations under the License. # -require "tempfile" unless defined?(Tempfile) -require "erubis" unless defined?(Erubis) +autoload :Tempfile, "tempfile" +autoload :Erubis, "erubis" class Chef module Mixin diff --git a/lib/chef/mixin/uris.rb b/lib/chef/mixin/uris.rb index ab33c6791e..74c2af73d8 100644 --- a/lib/chef/mixin/uris.rb +++ b/lib/chef/mixin/uris.rb @@ -16,8 +16,8 @@ # limitations under the License. # -require "uri" unless defined?(URI) -require "addressable/uri" unless defined?(Addressable::URI) +autoload :URI, "uri" +autoload :Addressable, "addressable/uri" class Chef module Mixin |