lib/tapioca/helpers/gem_helper.rb in tapioca-0.11.3 vs lib/tapioca/helpers/gem_helper.rb in tapioca-0.11.4
- old
+ new
@@ -8,15 +8,20 @@
sig { params(app_dir: T.any(String, Pathname), full_gem_path: String).returns(T::Boolean) }
def gem_in_app_dir?(app_dir, full_gem_path)
app_dir = to_realpath(app_dir)
full_gem_path = to_realpath(full_gem_path)
- !gem_in_bundle_path?(full_gem_path) && path_in_dir?(full_gem_path, app_dir)
+ !gem_in_bundle_path?(full_gem_path) && !gem_in_ruby_path?(full_gem_path) && path_in_dir?(full_gem_path, app_dir)
end
sig { params(full_gem_path: String).returns(T::Boolean) }
def gem_in_bundle_path?(full_gem_path)
path_in_dir?(full_gem_path, Bundler.bundle_path) || path_in_dir?(full_gem_path, Bundler.app_cache)
+ end
+
+ sig { params(full_gem_path: String).returns(T::Boolean) }
+ def gem_in_ruby_path?(full_gem_path)
+ path_in_dir?(full_gem_path, RbConfig::CONFIG["rubylibprefix"])
end
sig { params(path: T.any(String, Pathname)).returns(String) }
def to_realpath(path)
path_string = path.to_s