Skip to content

Commit

Permalink
Optimize our requires
Browse files Browse the repository at this point in the history
Avoid requiring things that are already defined. Rubygems is very slow at traversing the filesystem.

Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 committed Aug 21, 2020
1 parent d81f780 commit 4234e82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/mixlib/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
#

require "optparse"
require "optparse" unless defined?(OptionParser)
require_relative "cli/formatter"
module Mixlib

Expand Down

0 comments on commit 4234e82

Please sign in to comment.