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.
-Download and install from the Microsoft page.
-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).
--Start VSCode, search for the extension "ruby" and install it. (The figure below is the screen after installation)
--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>
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.
--Then, you will be asked what kind of configuration you want to configure, so select ruby
.
--Furthermore, select debug local file
.
--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.
}
]
}
--_ 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
.
that's all. The actual work was recorded on github. Each completed configuration file is in this commit.
Recommended Posts