Skip to content

Commit b716f08

Browse files
justin808claude
andcommitted
Remove dead code from run_rake_task_directly method
Remove unreachable Rails environment loading code that was guarded by 'unless defined?(Rails)'. This guard is dead code because: 1. run_rake_task_directly is only called when rails_available? is true 2. rails_available? explicitly checks defined?(Rails) and returns false if Rails is not defined 3. Therefore Rails is always defined when this method executes The removed line attempted to load config/environment using Dir.pwd, which was both unreachable and used the wrong path resolution method. Since Rails is guaranteed to be available in this context, we can rely on Rails.application.load_tasks directly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0993b48 commit b716f08

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

lib/react_on_rails/dev/pack_generator.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ def rails_available?
4545
def run_rake_task_directly(silent: false)
4646
require "rake"
4747

48-
# Load Rails environment if not already loaded
49-
require File.expand_path("config/environment", Dir.pwd) unless defined?(Rails)
50-
5148
# Load tasks only if not already loaded (don't clear all tasks)
5249
Rails.application.load_tasks unless Rake::Task.task_defined?("react_on_rails:generate_packs")
5350

0 commit comments

Comments
 (0)