fly-apps/dockerfile-rails

Gems installed with git break the scanner

louim opened this issue · 2 comments

louim commented

Hey Sam!

Thanks for all the work you've put into this gem. I'm currently running in an error from the scanner.rb when trying to determine if git is needed. My gemfile has multiple gems requiring git. This is the stacktrace when running bin/rails generate dockerfile

/Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/source/git/git_proxy.rb:224:in `allowed_with_path': The git source https://github.com/shrinerb/shrine.git is not yet checked out. Please run `bundle install` before trying to start your application (Bundler::GitError)
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/source/git/git_proxy.rb:190:in `find_local_revision'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/source/git/git_proxy.rb:62:in `revision'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/source/git.rb:234:in `revision'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/source/git.rb:103:in `install_path'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/definition.rb:284:in `block in spec_git_paths'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/definition.rb:284:in `map'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/definition.rb:284:in `spec_git_paths'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/dockerfile-rails-0.4.3/lib/dockerfile-rails/scanner.rb:31:in `scan_rails_app'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/dockerfile-rails-0.4.3/lib/generators/dockerfile_generator.rb:48:in `generate_app'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `block in invoke_all'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `each'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `map'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `invoke_all'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/group.rb:232:in `dispatch'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/bundler/gems/rails-ca3e163b7cf8/railties/lib/rails/generators.rb:275:in `invoke'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/bundler/gems/rails-ca3e163b7cf8/railties/lib/rails/commands/generate/generate_command.rb:26:in `perform'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/bundler/gems/rails-ca3e163b7cf8/railties/lib/rails/command/base.rb:69:in `perform'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/bundler/gems/rails-ca3e163b7cf8/railties/lib/rails/command.rb:48:in `invoke'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/bundler/gems/rails-ca3e163b7cf8/railties/lib/rails/commands.rb:18:in `<main>'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/skylight-5.3.4/lib/skylight/probes.rb:166:in `require'
	from /Users/louim/work/didacte/bin/rails:5:in `<main>'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/bundler/gems/rails-ca3e163b7cf8/activesupport/lib/active_support/fork_tracker.rb:10:in `block in fork'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/bundler/gems/rails-ca3e163b7cf8/activesupport/lib/active_support/fork_tracker.rb:10:in `block in fork'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/bundler/gems/rails-ca3e163b7cf8/activesupport/lib/active_support/fork_tracker.rb:8:in `fork'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/bundler/gems/rails-ca3e163b7cf8/activesupport/lib/active_support/fork_tracker.rb:8:in `fork'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/bundler/gems/rails-ca3e163b7cf8/activesupport/lib/active_support/fork_tracker.rb:27:in `fork'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/bundler/gems/rails-ca3e163b7cf8/activesupport/lib/active_support/fork_tracker.rb:8:in `fork'
	from /Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/bundler/gems/rails-ca3e163b7cf8/activesupport/lib/active_support/fork_tracker.rb:27:in `fork'
	from <internal:/Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/Users/louim/.asdf/installs/ruby/3.1.3/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from -e:1:in `<main>'

But the source is checked out and I'm able to start the application without any problem. I'm using the latest version (ATM) of the gem: 0.43. The problem is not specific to that gem, if commented from the file, it fails on the next one using git.

Happy to help debugging if you need more details!

louim commented

Annnnd as soon I post the issue, I find that it's now working as expected, something related to spring seemed to cause out of sync dependencies. Sorry for the noise 😢

rubys commented

This is actually useful feedback. Gems installed with git are no problem, but I'm currently presuming that a local bundle install or bundle update is run on your machine before running the generator. I'll add code to catch the error, print a warning, and proceed.