You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rails new test_project
cd test_project
echo"gem 'dotenv'">> Gemfile
bundle install
sed -i '1i$VERBOSE = true' config/application.rb
rails s
Expected behavior
No Ruby warnings should occur
Actual behavior
The following ruby warning occurs:
/home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74: warning: /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74: warning: loading in progress, circular require considered harmful - /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/dotenv-3.0.2/lib/dotenv.rb
from bin/rails:4:in `<main>'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/commands.rb:18:in `<main>'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command.rb:69:in `invoke'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command.rb:149:in `with_argv'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command.rb:71:in `block in invoke'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command/base.rb:73:in `perform'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/command/base.rb:178:in `invoke_command'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/commands/server/server_command.rb:136:in `perform'
from <internal:kernel>:90:in `tap'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/commands/server/server_command.rb:139:in `block in perform'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
from /home/myuser/code/test_project/config/application.rb:8:in `<main>'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundler.rb:187:in `require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundler/runtime.rb:44:in `require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundler/runtime.rb:44:in `each'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundler/runtime.rb:55:in `block in require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundler/runtime.rb:55:in `each'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundler/runtime.rb:60:in `block (2 levels) in require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from <internal:/home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from <internal:/home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/dotenv-3.0.2/lib/dotenv.rb:139:in `<main>'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/dotenv-3.0.2/lib/dotenv/rails.rb:7:in `<main>'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /home/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
System configuration
dotenv version: 3.0.2
Rails version: 7.1.3.2
Ruby version: 3.3.0
This is caused by the fact that in lib/dotenv.rb:139:
require"dotenv/rails"ifdefined?(Rails::Railtie)
But in lib/dotenv/rails.rb:7
require"dotenv"
I think the solution is to remove the latter require statement in lib/dotenv/rails.rb. This shouldn't be necessary since it is already required as the entrypoint of the gem. I suspect that it is still there from the time that Rails integration was a separate gem. Removing this gets rid of the warning in my app and does not seem to break the specs in the dotenv gem. I can make a PR if desired.
The text was updated successfully, but these errors were encountered:
Steps to reproduce
Expected behavior
No Ruby warnings should occur
Actual behavior
The following ruby warning occurs:
System configuration
dotenv version: 3.0.2
Rails version: 7.1.3.2
Ruby version: 3.3.0
This is caused by the fact that in
lib/dotenv.rb:139
:But in
lib/dotenv/rails.rb:7
I think the solution is to remove the latter require statement in
lib/dotenv/rails.rb
. This shouldn't be necessary since it is already required as the entrypoint of the gem. I suspect that it is still there from the time that Rails integration was a separate gem. Removing this gets rid of the warning in my app and does not seem to break the specs in the dotenv gem. I can make a PR if desired.The text was updated successfully, but these errors were encountered: