From 7cd521c4eca28cf24a1ae15f77d983db2be2e6a0 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Wed, 19 Aug 2020 22:58:00 -0700 Subject: Optimize our requires Avoid requiring things that are already defined. Rubygems is very slow at traversing the filesystem. Signed-off-by: Tim Smith --- lib/chef_zero/server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/chef_zero') diff --git a/lib/chef_zero/server.rb b/lib/chef_zero/server.rb index 2d699aa..aac9c5e 100644 --- a/lib/chef_zero/server.rb +++ b/lib/chef_zero/server.rb @@ -17,7 +17,7 @@ # require "openssl" unless defined?(OpenSSL) -require "open-uri" +require "open-uri" unless defined?(OpenURI) require "rubygems" unless defined?(Gem) require "timeout" unless defined?(Timeout) require "stringio" unless defined?(StringIO) -- cgit v1.2.1 From 128e40d7f932bce64fa2862a4639dffdade15a78 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Thu, 20 Aug 2020 00:23:42 -0700 Subject: Additional gates Signed-off-by: Tim Smith --- lib/chef_zero/chef_data/cookbook_data.rb | 2 +- lib/chef_zero/rest_request.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/chef_zero') diff --git a/lib/chef_zero/chef_data/cookbook_data.rb b/lib/chef_zero/chef_data/cookbook_data.rb index 747877a..86722d9 100644 --- a/lib/chef_zero/chef_data/cookbook_data.rb +++ b/lib/chef_zero/chef_data/cookbook_data.rb @@ -1,4 +1,4 @@ -require "digest/md5" +require "digest/md5" unless defined?(Digest::MD5) require "hashie" module ChefZero diff --git a/lib/chef_zero/rest_request.rb b/lib/chef_zero/rest_request.rb index c260316..2363b11 100644 --- a/lib/chef_zero/rest_request.rb +++ b/lib/chef_zero/rest_request.rb @@ -1,5 +1,5 @@ require "rack/request" -require "cgi" +require "cgi" unless defined?(CGI) module ChefZero class RestRequest -- cgit v1.2.1