chef / ffi-yajl

Ruby FFI gem wrapper around yajl2 library
MIT License
11 stars 21 forks source link

Optimize our requires #110

Closed tas50 closed 2 years ago

tas50 commented 4 years ago

Avoid requiring things that are already defined. Rubygems is very slow at traversing the filesystem.

Signed-off-by: Tim Smith tsmith@chef.io

mwrock commented 4 years ago

Looks like one of the specs is complaining about a missing constant:


An error occurred while loading ./spec/ffi_yajl/map_library_name_spec.rb.
--
  | Failure/Error: extend FFI_Yajl::MapLibraryName
  |  
  | NameError:
  | uninitialized constant FFI_Yajl::MapLibraryName
  | # ./spec/ffi_yajl/map_library_name_spec.rb:26:in `<class:Test>'
  | # ./spec/ffi_yajl/map_library_name_spec.rb:25:in `<top (required)>'
  | # ./vendor/bundle/ruby/2.6.0/gems/rspec-core-3.9.2/lib/rspec/core/configuration.rb:2103:in `load'
  | # ./vendor/bundle/ruby/2.6.0/gems/rspec-core-3.9.2/lib/rspec/core/configuration.rb:2103:in `load_file_handling_errors'
  | # ./vendor/bundle/ruby/2.6.0/gems/rspec-core-3.9.2/lib/rspec/core/configuration.rb:1606:in `block in load_spec_files'
  | # ./vendor/bundle/ruby/2.6.0/gems/rspec-core-3.9.2/lib/rspec/core/configuration.rb:1604:in `each'
  | # ./vendor/bundle/ruby/2.6.0/gems/rspec-core-3.9.2/lib/rspec/core/configuration.rb:1604:in `load_spec_files'
  | # ./vendor/bundle/ruby/2.6.0/gems/rspec-core-3.9.2/lib/rspec/core/runner.rb:102:in `setup'
  | # ./vendor/bundle/ruby/2.6.0/gems/rspec-core-3.9.2/lib/rspec/core/runner.rb:86:in `run'
  | # ./vendor/bundle/ruby/2.6.0/gems/rspec-core-3.9.2/lib/rspec/core/runner.rb:71:in `run'
  | # ./vendor/bundle/ruby/2.6.0/gems/rspec-core-3.9.2/lib/rspec/core/runner.rb:45:in `invoke'
  | # ./vendor/bundle/ruby/2.6.0/gems/rspec-core-3.9.2/exe/rspec:4:in `<main>'