Skip to content

[BUG] byebug should not be required anywhere in the lib directory #170

@etagwerker

Description

@etagwerker

Expected Behavior

v1.4.7 should just work without any issues.

If you add next_rails as a dependency it will fail to load:

      01 Bundler::GemRequireError: There was an error while trying to load the gem 'next_rails'.
      01 Gem Load Error is: cannot load such file -- byebug
      01 Backtrace for gem load error is:
      01 /var/apps/www/shared/bundle/ruby/3.2.0/gems/next_rails-1.4.7/lib/next_rails/bundle_report/cli.rb:6:in `require'
      01 /var/apps/www/shared/bundle/ruby/3.2.0/gems/next_rails-1.4.7/lib/next_rails/bundle_report/cli.rb:6:in `<top (required)>'
      01 /var/apps/www/shared/bundle/ruby/3.2.0/gems/next_rails-1.4.7/lib/next_rails.rb:7:in `require'
      01 /var/apps/www/shared/bundle/ruby/3.2.0/gems/next_rails-1.4.7/lib/next_rails.rb:7:in `<top (required)>'
      01 /var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:63:in `require'
      01 /var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:63:in `block (2 levels) in require'
      01 /var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:58:in `each'
      01 /var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:58:in `block in require'
      01 /var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:52:in `each'
      01 /var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:52:in `require'
      01 /var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler.rb:215:in `require'
      01 /var/apps/www/releases/20260323181146/config/application.rb:12:in `<top (required)>'
      01 /var/apps/www/releases/20260323181146/Rakefile:4:in `require'
      01 /var/apps/www/releases/20260323181146/Rakefile:4:in `<top (required)>'

Actual Behavior

CLI class should not have a require for byebug:

# frozen_string_literal: true

require "optparse"
require "next_rails"
require "next_rails/bundle_report"
require "byebug"

class NextRails::BundleReport::CLI

Because there is a require "byebug" it is causing an error:

Caused by:
LoadError: cannot load such file -- byebug
/var/apps/www/shared/bundle/ruby/3.2.0/gems/next_rails-1.4.7/lib/next_rails/bundle_report/cli.rb:6:in `require'
/var/apps/www/shared/bundle/ruby/3.2.0/gems/next_rails-1.4.7/lib/next_rails/bundle_report/cli.rb:6:in `<top (required)>'
/var/apps/www/shared/bundle/ruby/3.2.0/gems/next_rails-1.4.7/lib/next_rails.rb:7:in `require'
/var/apps/www/shared/bundle/ruby/3.2.0/gems/next_rails-1.4.7/lib/next_rails.rb:7:in `<top (required)>'
/var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:63:in `require'
/var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:63:in `block (2 levels) in require'
/var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:58:in `each'
/var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:58:in `block in require'
/var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:52:in `each'
/var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:52:in `require'
/var/apps/www/shared/bundle/ruby/3.2.0/gems/bundler-2.6.9/lib/bundler.rb:215:in `require'
/var/apps/www/releases/20260323181146/config/application.rb:12:in `<top (required)>'
/var/apps/www/releases/20260323181146/Rakefile:4:in `require'
/var/apps/www/releases/20260323181146/Rakefile:4:in `<top (required)>'
/var/apps/www/shared/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/share/rvm/gems/ruby-3.2.0/bin/ruby_executable_hooks:22:in `eval'
/usr/share/rvm/gems/ruby-3.2.0/bin/ruby_executable_hooks:22:in `<main>'
(See full trace by running task with --trace)

Possible Fix

Do not require "byebug"

byebug is not a dependency of next_rails, it is only a development dependency.

To Reproduce

Just try to load your application with this line in it:

# Gemfile
gem "next_rails", "1.4.7"

There is a weird edge case if you have this in your Gemfile it probably works:

# Gemfile
gem "next_rails", "1.4.7"
gem "byebug"

I will abide by the code of conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions