diff --git a/lib/gem_bench.rb b/lib/gem_bench.rb index 73435e8..504a72f 100644 --- a/lib/gem_bench.rb +++ b/lib/gem_bench.rb @@ -2,13 +2,14 @@ require "version_gem" require "bundler" # This gem utilizes bundler as a tool. -require "gem_bench/version" -require "gem_bench/scout" -require "gem_bench/player" -require "gem_bench/team" -require "gem_bench/gemfile_line_tokenizer" -require "gem_bench/strict_version_gem" -require "gem_bench/strict_version_requirement" +# this library +require_relative "gem_bench/version" +require_relative "gem_bench/scout" +require_relative "gem_bench/player" +require_relative "gem_bench/team" +require_relative "gem_bench/gemfile_line_tokenizer" +require_relative "gem_bench/strict_version_gem" +require_relative "gem_bench/strict_version_requirement" module GemBench USAGE = "[GemBench] Usage: Require another gem in this session to evaluate it.\n\tExample:\n\t\trequire 'rails'\n\t\tGemBench.check({verbose: true})\n" diff --git a/lib/gem_bench/jersey.rb b/lib/gem_bench/jersey.rb index f4acfdf..a69fea3 100644 --- a/lib/gem_bench/jersey.rb +++ b/lib/gem_bench/jersey.rb @@ -110,15 +110,14 @@ def as_klass private def load_gem_copy(files) + puts "Requiring copy of #{gem_name} with: #{files.inspect}" if verbose + # These are absolute file paths, so they can use `require` files.each do |filepath| - # begin + # But files required here may not load their own internal files properly if they are still using `require`. + # Since Ruby 2.2, best practice for ruby libraries is to use require_relative for internal files, + # and require for external files and dependencies. + # Ref: https://github.com/panorama-ed/memo_wise/issues/349 require filepath - # rescue LoadError => e - # puts file.to_s - # puts tempfile.path - # puts e.class - # puts e.message - # end end end