Reputation: 17981
https://github.com/Shopify/bootsnap would load all ruby files at launch. However I have certain need to not load a specific directory. Is there a configuration for doing that? Or is there a simple monkey patch to achieve the same thing?
Upvotes: 2
Views: 199
Reputation: 4378
Looking at the source of the gem, I've not been able to see any configuration to exclude certain paths from being cached.
However, I think you can define your paths which needs to be excluded in the following file (monkey patching):
https://github.com/Shopify/bootsnap/blob/master/lib/bootsnap/load_path_cache/path_scanner.rb#L39
Dir.glob(path + ALL_FILES).each do |absolute_path|
next if contains_bundle_path && absolute_path.start_with?(BUNDLE_PATH)
relative_path = absolute_path.slice(relative_slice)
// Here match your path with the relative path and skip the loop iteration
if File.directory?(absolute_path)
dirs << relative_path
elsif REQUIRABLE_EXTENSIONS.include?(File.extname(relative_path))
requirables << relative_path
end
end
Upvotes: 1