railsbump / app

Check which gems are compatible with which Rails version!
https://railsbump.org
MIT License
152 stars 20 forks source link

GemfilesController#create raises Gemfiles::Create::Error -- There was an error parsing #54

Closed etagwerker closed 4 years ago

etagwerker commented 4 years ago

Hey,

It seems that checking a gemfile is not working:

(byebug) e.class
Gemfiles::Create::Error
(byebug) e.message
"\n[!] There was an error parsing ``: \n[!] There was an error parsing `Gemfile`: No such file or directory @ rb_sysopen - /Users/etagwerker/Projects/fastruby/common-gems/rails/Gemfile. Bundler cannot continue.\n. Bundler cannot continue.\n\n #  from /Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/bundler-2.1.4/lib/bundler.rb:535\n #  -------------------------------------------\n #   >   #  \n #  -------------------------------------------\n"
(byebug) puts e.message

[!] There was an error parsing ``:
[!] There was an error parsing `Gemfile`: No such file or directory @ rb_sysopen - /Users/etagwerker/Projects/fastruby/common-gems/rails/Gemfile. Bundler cannot continue.
. Bundler cannot continue.

 #  from /Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/bundler-2.1.4/lib/bundler.rb:535
 #  -------------------------------------------
 #   >   #
 #  -------------------------------------------
nil
(byebug) puts e.backtrace
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/services-7.3.1/lib/services/modules/exception_wrapper.rb:10:in `rescue in call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/services-7.3.1/lib/services/modules/exception_wrapper.rb:4:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/services-7.3.1/lib/services/modules/call_logger.rb:36:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/services-7.3.1/lib/services/base.rb:21:in `call'
/Users/etagwerker/Projects/fastruby/railsbump/app/controllers/gemfiles_controller.rb:7:in `create'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/abstract_controller/base.rb:195:in `process_action'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_controller/metal/rendering.rb:30:in `process_action'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:112:in `block in run_callbacks'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/marginalia-1.8.0/lib/marginalia.rb:111:in `record_query_comment'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:139:in `run_callbacks'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/abstract_controller/callbacks.rb:41:in `process_action'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_controller/metal/rescue.rb:22:in `process_action'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/activesupport-6.0.3/lib/active_support/notifications.rb:180:in `block in instrument'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/activesupport-6.0.3/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/activesupport-6.0.3/lib/active_support/notifications.rb:180:in `instrument'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/activerecord-6.0.3/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/abstract_controller/base.rb:136:in `process'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionview-6.0.3/lib/action_view/rendering.rb:39:in `process'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_controller/metal.rb:190:in `dispatch'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_controller/metal.rb:254:in `dispatch'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/routing/route_set.rb:33:in `serve'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/journey/router.rb:49:in `block in serve'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/journey/router.rb:32:in `each'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/journey/router.rb:32:in `serve'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/routing/route_set.rb:834:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rack-attack-6.3.0/lib/rack/attack.rb:111:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rack-2.0.9/lib/rack/tempfile_reaper.rb:15:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rack-2.0.9/lib/rack/etag.rb:25:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rack-2.0.9/lib/rack/conditional_get.rb:38:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rack-2.0.9/lib/rack/head.rb:12:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rack-2.0.9/lib/rack/session/abstract/id.rb:259:in `context'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rack-2.0.9/lib/rack/session/abstract/id.rb:253:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/middleware/cookies.rb:648:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/activerecord-6.0.3/lib/active_record/migration.rb:567:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:101:in `run_callbacks'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/middleware/executor.rb:14:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rollbar-2.25.0/lib/rollbar/middleware/rails/rollbar.rb:25:in `block in call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rollbar-2.25.0/lib/rollbar.rb:145:in `scoped'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rollbar-2.25.0/lib/rollbar/middleware/rails/rollbar.rb:22:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/better_errors-2.6.0/lib/better_errors/middleware.rb:84:in `protected_app_call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/better_errors-2.6.0/lib/better_errors/middleware.rb:79:in `better_errors_call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/better_errors-2.6.0/lib/better_errors/middleware.rb:57:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rollbar-2.25.0/lib/rollbar/middleware/rails/show_exceptions.rb:22:in `call_with_rollbar'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/railties-6.0.3/lib/rails/rack/logger.rb:37:in `call_app'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/railties-6.0.3/lib/rails/rack/logger.rb:26:in `block in call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/activesupport-6.0.3/lib/active_support/tagged_logging.rb:80:in `block in tagged'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/activesupport-6.0.3/lib/active_support/tagged_logging.rb:28:in `tagged'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/activesupport-6.0.3/lib/active_support/tagged_logging.rb:80:in `tagged'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/railties-6.0.3/lib/rails/rack/logger.rb:26:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rack-2.0.9/lib/rack/method_override.rb:22:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rack-2.0.9/lib/rack/runtime.rb:22:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/activesupport-6.0.3/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/middleware/executor.rb:14:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/middleware/static.rb:126:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rack-2.0.9/lib/rack/sendfile.rb:111:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/actionpack-6.0.3/lib/action_dispatch/middleware/host_authorization.rb:82:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/webpacker-5.1.1/lib/webpacker/dev_server_proxy.rb:25:in `perform_request'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/rack-proxy-0.6.5/lib/rack/proxy.rb:57:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/railties-6.0.3/lib/rails/engine.rb:527:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/puma-4.3.3/lib/puma/configuration.rb:228:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/puma-4.3.3/lib/puma/server.rb:682:in `handle_request'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/puma-4.3.3/lib/puma/server.rb:472:in `process_client'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/puma-4.3.3/lib/puma/server.rb:328:in `block in run'
/Users/etagwerker/.rvm/gems/ruby-2.6.6/gems/puma-4.3.3/lib/puma/thread_pool.rb:134:in `block in spawn_thread'
nil

Steps to reproduce

  1. Go to http://localhost:3000/gemfiles/new
  2. Submit the Gemfile that is present in this project
  3. It will raise an exception

Not sure why that is happening as it seems that it's a valid ruby file.

My best guess is that this line is messing things up:

https://github.com/manuelmeurer/railsbump/blob/master/app/services/gemfiles/create.rb#L18

Thoughts?

manuelmeurer commented 4 years ago

No, the problem is that the Gemfile of this projects requires some stuff from https://github.com/manuelmeurer/common-gems, which is symlinked to common-gems: https://github.com/manuelmeurer/railsbump/blob/f33670734c2c8a17c29a2594c35212d595b26b04/Gemfile#L22

But of course this cannot be found when parsing the Gemfile. I think eval_gemfile is one of the commands that should be ignored when a Gemfile is parsed. Could you have a look at #45?