• Sign In



  • Categories

    Extension Details



    Readme

    Ruby Debug for Nova

    Connect Nova to the Ruby Debug gem enabling local and remote debugging.

    The connection is made possible by the rdbg command. This is why you can consider the extension as the Nova's vscode-rdbg counterpart.

    Please be patient if you get into issues or limitations. We are still testing and improving the extension.

    Right now not all the settings and features of vscode-rdbg are supported.
    This is true especially for the remote debugger.
    The aim in the future is to bring it near to a one to one porting.

    Requirements

    You need to install latest debug gem and rdbg command should be in $PATH.

    $ gem install debug
    

    If you are using ruby 3.1.0 or later the debug gem comes bundled.

    Local debugging (launch)

    Setup

    To start using the local debugger go to Nova's Project Settings and add a new "Ruby Debug" task from the provided template.

    Usage

    You can configure the debugger as you like in the Project Settings or run it as it is.
    The default configuration will try to find the rdbg command on your machine and run the current open file in Nova with the ruby command.

    If a breakpoint is found, the program execution should pause and the debugger console should appear.

    Remote debugging (attach)

    Setup

    To start using the remote debugger go to Nova's Project Settings and add a new "Ruby Remote Debug" task from the provided template.

    Usage

    To use the remote debugger make sure you are running the rdbg command with the --open flag.
    This informs rdbg to listen for connections from the outside.

    Right now the only connection method allowed is domainSocket.
    It means that if at startup the debugger finds a single open socketPath will use that, otherwise you have to specify which one to use.

    Specifying the socketPath

    Start by generating a socketPath with the rdbg --util=gen-sockpath command.
    It should print something like:

    /var/folders/0y/5cyl_crn3mv0y_gyg734ty2h0000gn/T/ruby-debug-sock-501/ruby-debug-tommaso-71169
    

    Next configure the rdbg command to use the generated socket by specifying --sock-path=SOCK_PATH.

    The last step is to tell the remote debugger to use the generated socket. You can do that in the Ruby Remote Debug task settings.

    Examples

    Ruby on Rails

    Allow remote debugging by running rails server under rdbg:

    $ rdbg --command --open --nonstop -- rails server
    

    To use the new bin/dev command edit your Procfile.dev accordingly:

    web: rdbg --command --open --nonstop -- bin/rails server -p 3000
    css: bin/rails tailwindcss:watch
    

    Contributing

    You are welcome to contribute to the development!

    All you have to do to get up and running is to fork, download and rename the folder from nova-ruby-debug to Ruby Debug.novaextension.
    After that you should be able to active the project as extension from the Nova's Extensions menu.

    Release Notes

    Version 1.0

    Initial release

    License

    MIT License

    Copyright (c) 2022 Tommaso Negri

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.