Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make bundle exec inferno start work #502

Merged
merged 8 commits into from
Jun 24, 2024
Merged

Conversation

Shaumik-Ashraf
Copy link
Contributor

@Shaumik-Ashraf Shaumik-Ashraf commented Jun 10, 2024

Summary

IT WORKED! This is a rogue PR but please let this be a feature, maybe after the upcoming push to production. Putting up as draft (see TODOs below), but I'm not opposed to just merging it if people approve.

Testing Guidance

  1. Check out this branch
  2. bundle exec bin/inferno services
  3. bundle exec bin/inferno start

Possible TODOs:

  1. It still outputs "You must install foreman with 'gem install foreman' prior to running Inferno" because it can't detect foreman in the bundler env, but then will still run anyways in non-bundler env. We can fix this with another if but I'll try to do it in a cleaner way. Resolved
  2. While we're doing this, do we want to handle the case of if they have foreman installed within the bundler env? IMHO that would be too opinionated.
  3. Rspec it

@Shaumik-Ashraf Shaumik-Ashraf marked this pull request as draft June 10, 2024 20:47
Copy link

codecov bot commented Jun 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.70%. Comparing base (0f07266) to head (3474d00).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #502   +/-   ##
=======================================
  Coverage   79.70%   79.70%           
=======================================
  Files         240      240           
  Lines       11927    11927           
  Branches     1169     1169           
=======================================
  Hits         9506     9506           
  Misses       1757     1757           
  Partials      664      664           
Flag Coverage Δ
backend 92.27% <ø> (ø)
frontend 74.06% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mrnosal
Copy link

mrnosal commented Jun 12, 2024

If this PR is approved and merged, then the documentation at https://github.com/inferno-framework/inferno-framework.github.io/blob/main/docs/getting-started/inferno-cli.md should be updated. That page specifically states that inferno start cannot be run with bundle exec

Copy link
Collaborator

@Jammjammjamm Jammjammjamm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work for me.

~/code/inferno (bundle-exec-inferno-start ✘)✭ ᐅ be bin/inferno start
I, [2024-06-18T08:37:38.872621 #90054]  INFO -- : (0.000261s) PRAGMA foreign_keys = 1
I, [2024-06-18T08:37:38.872667 #90054]  INFO -- : (0.000006s) PRAGMA case_sensitive_like = 1
bundler: failed to load command: bin/inferno (bin/inferno)
/Users/smacvicar/code/inferno/lib/inferno/apps/cli/main.rb:72:in `without_bundler': undefined local variable or method `block' for #<Inferno::CLI::Main:0x000000010a106a98 @_invocations={Inferno::CLI::Main=>["start"]}, @_initializer=[[], [], {:shell=>#<Thor::Shell::Color:0x000000010a1079e8 @base=#<Inferno::CLI::Main:0x000000010a106a98 ...>, @mute=false, @padding=0, @always_force=false>, :current_command=>#<struct Thor::Command name="start", description="Start Inferno", long_description=nil, usage="start", options={:watch=>#<Thor::Option:0x000000010a15cc68 @check_default_type=nil, @repeatable=false, @name="watch", @description="Automatically restart Inferno when a file is changed.", @required=false, @type=:boolean, @default=false, @banner=nil, @enum=nil, @lazy_default=nil, @aliases=[], @hide=nil, @human_name="watch", @switch_name="--watch">}, ancestor_name=nil>}], @options={"watch"=>false}, @args=[], @shell=#<Thor::Shell::Color:0x000000010a1079e8 @base=#<Inferno::CLI::Main:0x000000010a106a98 ...>, @mute=false, @padding=0, @always_force=false>> (NameError)

          Bundler.with_unbundled_env(&block)
                                      ^^^^^
	from /Users/smacvicar/code/inferno/lib/inferno/apps/cli/main.rb:31:in `start'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
	from bin/inferno:7:in `<top (required)>'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.23/lib/bundler/cli/exec.rb:58:in `load'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.23/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.23/lib/bundler/cli/exec.rb:23:in `run'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.23/lib/bundler/cli.rb:486:in `exec'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.23/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.23/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.23/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.23/lib/bundler/cli.rb:31:in `dispatch'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.23/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.23/lib/bundler/cli.rb:25:in `start'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.23/exe/bundle:48:in `block in <top (required)>'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.23/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.23/exe/bundle:36:in `<top (required)>'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/bin/bundle:25:in `load'
	from /Users/smacvicar/.asdf/installs/ruby/3.1.2/bin/bundle:25:in `<main>'

@Shaumik-Ashraf
Copy link
Contributor Author

It broke because of a bug in rubocop. I just disabled it where it mattered so bundle exec inferno start can work but arguably we should disable Naming/BlockForwarding across the app or update rubocop to latest.

@Shaumik-Ashraf Shaumik-Ashraf merged commit 732d0cd into main Jun 24, 2024
10 checks passed
@Shaumik-Ashraf Shaumik-Ashraf deleted the bundle-exec-inferno-start branch June 24, 2024 13:08
@rpassas rpassas mentioned this pull request Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants