From 4234e82751efb1822782e6e9f43d9b0438d8ecc4 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 21 Aug 2020 11:06:10 -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 --- Rakefile | 4 ++-- lib/mixlib/cli.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index bcbe224..1d5a2f5 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." @@ -33,7 +33,7 @@ end task :console do require "irb" require "irb/completion" - require "mixlib/cli" + require "mixlib/cli" unless defined?(Mixlib::CLI) ARGV.clear IRB.start end diff --git a/lib/mixlib/cli.rb b/lib/mixlib/cli.rb index b8f5748..a721abf 100644 --- a/lib/mixlib/cli.rb +++ b/lib/mixlib/cli.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require "optparse" +require "optparse" unless defined?(OptionParser) require_relative "cli/formatter" module Mixlib -- cgit v1.2.1