-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not put current directory in LOAD_PATH #114
Comments
I also make a PR #115 |
It's done in order for |
Oh, I understand. May be this can be done without loading current directory to E.g. opts.on("-r", "--require STRING", "Require a library before starting the consumer") do |lib|
begin
require lib
rescue LoadError => _exception
require File.join(Dir.pwd, lib)
end
end What do you think? |
I think that will subtly change how Ruby loads files, which may cause files to be loaded twice. The string passed to |
Does Rails not also put the current dir in the load path? Or is it just |
I think one way to deal with this would be to only add to the load pass if |
Yes, just |
It would be a breaking change to change from current dir to |
Not quite understand. Do you mean this? opts.on("-r", "--require STRING", "Require a library before starting the consumer") do |lib|
begin
require lib
rescue LoadError => _exception
$LOAD_PATH.unshift(Dir.pwd)
require lib
end
end |
Or? opts.on("-r", "--require STRING", "Require a library before starting the consumer") do |lib|
$LOAD_PATH.unshift(Dir.pwd)
require lib
end |
Not quite. More like load_path_modified = false
# ...
opts.on("-r", "--require STRING", "Require a library before starting the consumer") do |lib|
$LOAD_PATH.unshift(Dir.pwd) unless load_path_modified
load_path_modified = true
require lib
end |
🤔 why we need |
You can require multiple files, e.g. |
Your suggested solution - #117 |
Hello everybody!
First of all, thanks for making such a good project. It is a great addition to such a low-level ruby-kafka :)
My question...
I have found a strange issue using racecar + bootsnap.
As you may know Bootsnap recursively scans everything in
$LOAD_PATH
and caches all paths to speed up application boot process.Also I have found that racecar adds current directory to $LOAD_PATH - 0849ecc.
This causes bootsnap to scan every directory in my rails project :) including shared storage linked to
public/uploads
.So my question: is it necessary to put current directory into
$LOAD_PATH
?The text was updated successfully, but these errors were encountered: