TheOdinProject / ruby-exercises

MIT License
219 stars 1.06k forks source link

Debugging exercises with bundle exec commands #72

Closed JoshDevHub closed 1 year ago

JoshDevHub commented 2 years ago

Currently, the instructions for these exercises want users to install rspec from the Gemfile using bundle install and then from there, run tests using bundle exec rspec path_to/file_spec.rb. This works fine up until users start the debugging content, where the user cannot access their global install of pry-byebug while running commands prefixed with bundle exec -- leading to require bugs that learners at this stage have a difficult time figuring out. Here's an example from the discord server today, but it has happened multiple times since the debugging exercises were introduced.

I think there are two good ways to approach fixing the problem:

  1. Go ahead and have the users globally install RSpec -- this is done later down the line anyway -- and then forgo the use of bundle exec entirely.
  2. Place pry-byebug in the Gemfile. It will then be installed in the users' local repo when they initially run bundle install, which will eliminate require errors when using bundle exec.

Would be glad to submit a PR for whichever method is preferable. Also definitely open to other ideas if there are other ways to make this work more smoothly.

ChargrilledChook commented 2 years ago

This has occurred to me before too, I do think it should be changed one way or the other. My instinct is that we should prefer doing it globally, because there is essentially zero content about bundler before doing the exercises. Makes it very easy for people to make mistakes because they don't have much context about the commands they're using.

Let me think about it a bit / raise it with the team, also happy to hear any other thoughts or ideas you have on the subject. Maybe there's room for some broader improvements in this area

JoshDevHub commented 2 years ago

Yeah I think I agree re: having learners go ahead and globally install rspec. I guess one other consideration with keeping bundler is that the curriculum may eventually move on from pry altogether in support of the debug gem, and this would be one more (admittedly small) thing to update should that happen.

rlmoser99 commented 1 year ago

I'm a little late to the party, but I think we should make this change (step 1 and 2 above). As far as the idea of moving away from pry, I don't see us eliminating it for the foreseeable future because many rails apps still rely on debugging with these tools. @JoshDevHub are you still willing to make these changes, or should we open this up to others?

ChargrilledChook commented 1 year ago

Pry vs Debug probably needs more discussion (debug would be my own preference) but I think we agree that the bundler issue needs to be solved, so lets go ahead with changing this to use rspec globally.

@JoshDevHub I'll open this to public submissions but you're free to take it if you're still interested

JoshDevHub commented 1 year ago

@ChargrilledChook Yeah I'll be glad to take it. I don't know how I missed rlmoser's ping back in September :man_facepalming:

ChargrilledChook commented 1 year ago

@JoshDevHub No worries mate, I've assigned this one to you 👌