MiniProfiler / rack-mini-profiler

Profiler for your development and production Ruby rack apps.
MIT License
3.73k stars 406 forks source link

Impossible to add "rack-mini-profiler" gem via a custom application template since 2.0.3 version #457

Closed dlupu closed 4 years ago

dlupu commented 4 years ago

Hello,

I have a custom application template that I use as starting base on all my projects. I realized this morning that it's no longer working as I expected and managed to determine the problem is in the current last release (2.0.3).

Steps to reproduce

Create a custom application template

# custom_template.rb

gem_group :development, :test do
  gem 'rack-mini-profiler'
end

Create a new rails app using the following command

rails new your_new_app_name --database postgresql --skip-coffee --skip-test --skip-system-test --webpacker -m custom_template.rb

Note: only the -m custom_template.rb is important in order to reproduce the issue

When the creation script runs the comment rails webpack:install we get the error

rails aborted!
Webpacker configuration file not found /Users/me/Projects/your_new_app_name/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /Users/me/Projects/your_new_app_name/config/webpacker.yml
/Users/me/Projects/your_new_app_name/config/environment.rb:5:in `<main>'
/Users/me/Projects/your_new_app_name/bin/rails:9:in `<top (required)>'
/Users/me/Projects/your_new_app_name/bin/spring:15:in `require'
/Users/me/Projects/your_new_app_name/bin/spring:15:in `<top (required)>'
./bin/rails:3:in `load'
./bin/rails:3:in `<main>'

Caused by:
Errno::ENOENT: No such file or directory @ rb_sysopen - /Users/me/Projects/your_new_app_name/config/webpacker.yml
/Users/me/Projects/your_new_app_name/config/environment.rb:5:in `<main>'
/Users/me/Projects/your_new_app_name/bin/rails:9:in `<top (required)>'
/Users/me/Projects/your_new_app_name/bin/spring:15:in `require'
/Users/me/Projects/your_new_app_name/bin/spring:15:in `<top (required)>'
./bin/rails:3:in `load'
./bin/rails:3:in `<main>'
Tasks: TOP => app:template => environment
(See full trace by running task with --trace)

Did someone else run into this issue?

dlupu commented 4 years ago

I think the problem is caused by this line

As a workaround, I changed my custom application template to and that seems to fix the problem

# custom_template.rb

after_bundle do
  run('bundle add rack-mini-profiler --group "development,test"')
end
SamSaffron commented 4 years ago

@OsamaSayegh can you have a look at this?

OsamaSayegh commented 4 years ago

Thank you @dlupu for reporting this, I've just pushed a fix here: https://github.com/MiniProfiler/rack-mini-profiler/commit/7453c58cc0fd1aa5eade8de9ad3c1b774f2a010b.

I'll close this issue once we've pushed a new release with the fix.

SamSaffron commented 4 years ago

2.0.4 is out with the fix :confetti_ball:

dlupu commented 4 years ago

Hello @OsamaSayegh Just wanted to confirm that version 2.0.4 does indeed fix the problem. Thank you very much for your rapid fix.