Build ruby debug environment with VS Code of Windows 10

Introduction

When I tried to create a ruby environment for the first time in over a year, it didn't go well and I finally created an environment, so I'll leave a note. Now you can execute steps and check variables with ruby.

Install Visual Studio Code

-Download and install from the Microsoft page.

Ruby installation

-Install using the installer with devkit on the Ruby Installer site. This time I used [rubyinstaller-devkit-2.6.6-1-x64.exe](https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.6-1/rubyinstaller-devkit-2.6 .6-1-x64.exe).

Install VS Code extension

--Start VSCode, search for the extension "ruby" and install it. (The figure below is the screen after installation) image.png

Install Gem with bundle

--Open VS Code terminal and bundle init.

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\momoandbanana\Documents\my_ruby_programs\debugenv> bundle init
Writing new Gemfile to C:/Users/momoandbanana/Documents/my_ruby_programs/debugenv/Gemfile
PS C:\Users\momoandbanana\Documents\my_ruby_programs\debugenv> 

--Then a Gemfile will be created, so add the debase and ruby-debug-ide Gem.

Gemfile


# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# gem "rails"
gem "debase" #Added
gem "ruby-debug-ide" #Added

--Install Gem with bundle install in VS Code terminal.

PS C:\Users\momoandbanana\Documents\my_ruby_programs\debugenv> bundle init
Writing new Gemfile to C:/Users/momoandbanana/Documents/my_ruby_programs/debugenv/Gemfile
PS C:\Users\momoandbanana\Documents\my_ruby_programs\debugenv> bundle install
Fetching gem metadata from https://rubygems.org/.....
Resolving dependencies...
Using rake 13.0.1
Using bundler 2.1.4
Using debase-ruby_core_source 0.10.9
Using debase 0.2.4.1
Using ruby-debug-ide 0.7.2
Bundle complete! 2 Gemfile dependencies, 5 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
PS C:\Users\momoandbanana\Documents\my_ruby_programs\debugenv> 

Describe the setting in lunch.json.

--Prepare a ruby program.

main.rb


puts("hello ruby-debugger !")

--Select Run`` Open Configuration from the VS Code menu for __ to have lunch.json created __automatically. image.png

--Then, you will be asked what kind of configuration you want to configure, so select ruby. image.png

--Furthermore, select debug local file. image.png

--Then, the launch.json file will be created. Modify the program line as follows.

launch.json


{
    //You can use IntelliSense to learn the available attributes.
    //Hover and display the description of existing attributes.
    //Check the following for more information: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug Local File",
            "type": "Ruby",
            "request": "launch",
            // "program": "${workspaceRoot}/main.rb",I made a comment.
            "program": "${file}", //It has changed.
        }
    ]
}

Start debugging

--_ Open the source file, and from __, debug with the VS Code Run`` Start Debugging. The figure below shows a break by setting a breakpoint on the first line of main.rb. image.png

that's all. The actual work was recorded on github. Each completed configuration file is in this commit.

Recommended Posts

Build ruby debug environment with VS Code of Windows 10
Create Spring Boot environment with Windows + VS Code
Build a Java development environment with VS Code
Format Ruby with VS Code
Ruby ① Build a Windows environment
Build Java development environment with VS Code on Mac
Build Java development environment with WSL2 Docker VS Code
How to build Java development environment with VS Code
[Environment construction] Build a Java development environment with VS Code!
Java build with mac vs code
The procedure I did when I prepared the environment of gradle + Java with VS Code (Windows 10)
Prepare Java development environment with VS Code
Building a haskell environment with Docker + VS Code on Windows 10 Home
Self-hosting with Docker of AuteMuteUs in Windows environment
Using Gradle with VS Code, build Java → run
Lombok with VS Code
Build VS Code + WSL + Java + Gradle environment from scratch
Build an environment of Ruby2.7.x + Rails6.0.x + MySQL8.0.x with Docker
Build Java program development environment with Visual Studio Code
Beginners create Spring Tools Suite environment with VS Code
Docker management with VS Code
Hello World with VS Code!
Build docker environment with WSL
Java web application development environment construction with VS Code (struts2)
Try debugging natural language processing on Windows. with VS Code
Build WebAPP development environment with Java + Spring with Visual Studio Code
Build Couchbase local environment with Docker
Build a Node.js environment with Docker
Build a Tomcat 8.5 environment with Pleiades 4.8
Create RUNTEQ's environment with Windows DockerDesktop
Summary of steps for developing in Docker container with VS Code
I tried to build the environment of PlantUML Server with Docker
Spring Boot programming with VS Code
Build environment with vue.js + rails + docker
Until you run Hello World of JavaFX with VS Code + Gradle
Build Rails environment with Docker Compose
Build a development environment where Ruby on Rails breakpoints work on Windows
Build jooby development environment with Eclipse
Impressions of making BlackJack-cli with Ruby
Getting Started with Docker with VS Code
[Be careful about changing the version of Xdebug! ] Create a development environment with Xdebug3 + docker + VS Code
Java development environment (Mac, VS Code)
Steps to build a Ruby on Rails development environment with Vagrant
Build docker + laravel environment with laradock
Build a Docker-based development environment on Windows 10 Home 2020 ver. Part 2 VS Code should make the Docker development environment comfortable
When I tried to build an environment of PHP7.4 + Apache + MySQL with Docker, I got stuck [Windows & Mac]
Build a Windows application test environment with Selenium Grid, Appium, and Windows Application Driver
Build a hot reload development environment with Docker-compose using Realize of Go
01. I tried to build an environment with SpringBoot + IntelliJ + MySQL (MyBatis) (Windows10)
How to build an environment for any version of Ruby using rbenv
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
Template: Build a Ruby / Rails development environment with a Docker container (Ubuntu version)
Template: Build a Ruby / Rails development environment with a Docker container (Mac version)
Introduction to Java development environment & Spring Boot application created with VS Code
Build a PureScript development environment with Docker
Build and manage RStudio environment with Docker-compose
Try using Spring Boot with VS Code
Extract a part of a string with Ruby
Build a Wordpress development environment with Docker
Build Redmine code reading environment on Docker