Go to the debug tab on VS Code and click the gear icon. That will open the launch.json file which should have a load of configurations marked with type: "Ruby" and, if there aren’t any for some magical reason, then you can add them manually. In case something weird happens to you the configuration for debugging a Rails server is found below. That should do it! Now if you click run with the Rails server option selected in the drop down it will start up in debug mode and a little menu will appear at the top of the screen with debug options such as continue and step over. The bar at the bottom of the window even changes color to indicate it is in debug mode. Now that the server has been started in debug mode, we can add some breakpoints to step into the code and see what is happening. So I have put a breakpoint into my code (please don’t make any comments on my code!) and let's see what happens. If you don’t know how to add a breakpoint, just click to the left of the line number that you want it on and then the dot will appear like in the image above. I am pretty sure the dot will always be red, but I am not 100% sure that it can’t be changed through themes. Now if I call this method it will pause when it reaches the breakpoint. Worked fine for me.If you were in a browser it should open VS Code and wait for your next move.Īt this point, you can decide to just carry on normal execution by pressing continue (f5) or step over (f10), there are a few more options, but I’m too lazy to write them down. No need to worry, clean up the project, and set this up again. There might be times when indexes get corrupt and the whole rubymine is unable to detect dependencies and perform the run tasks. In short map Local Path: //wsl$/Ubuntu-18.04/home/user/code/test_project to Remote Path: /home/user/code/test_project and from now on you are good to run your code in you rubymine. Here there is a small change, you will need to map the local and remote path. You can do this by checking the edit configurations as mentioned here. In my case I wanted to set up the rake task. The next part is understanding the path that is associated with WSL and how they map to actual windows path. From here you will be able to get all the projects and dependencies and select the remote SDK. This is also available when you type ‘whereis ruby` in your wsl. Please check the output from by running in an irb ( ) and use that. THis will require the Unix name of the folder where ruby is. Please check if you get errors like “unable to read rbconfig from specified interpreter”, this means the path to RBConfig is not correct. Here in this link they mention about pointing to rvm for remote ruby interpreter or version manager, I pointed it to rbenv path for ruby. Once you are comfortable running the application from a WSL command line, using rake or rails or other tools like Heroku, we can shift to Rubymine. This is important to debug the configuration set ups in case of issues. I suggest setting up a running project either downloaded from GIT, or made locally, and ensure it works fine. In fact when initially WSL2 could not connect to network and I had to reset all network adapters as mentioned here( ) We can migrate to WSL2, and the recent documentation is available here ( ). In the link they have mentioned about setting up the Postgres database using a windows installer, I was able to set it up within WSL environment itself. The link here provides detailed steps on how to set this up with a Postgres backend.( ). In case you do not want to use Rubymine, still WSL is a good choice for setting up the Ruby projects. While providing the options the documentation recommends usage of WSL Windows Subsystem for Linux which is available as an application as well as configuration of windows developer tools. The installation options for rubymine is fairly detailed here, and easy to follow –. Though there is a license fee associated with its usage, but then it is worth it in my opinion. Rubymine is an excellent IDE when working on Ruby projects.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |