# RubyDebug **Repository Path**: jiodg45/ruby-debug ## Basic Information - **Project Name**: RubyDebug - **Description**: debug cocoapods with ruby - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-06-22 - **Last Updated**: 2021-06-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Debug ruby in vscode 1. install ruby extension ruby-Debug, ruby 2. add Gemfile ```ruby source 'https://gems.ruby-china.com/' gem 'debase' gem 'ruby-debug-ide' gem 'readapt', group: :development ``` 3. add `configuration.json` to `.vscode/launch.json` ```json { "configurations": [ { "name": "Debug CocoaPods Plugin with Bundler", "type": "ruby-debug", "request": "launch", "useBundler": true, "program": "${workspaceRoot}/main.rb", } ] } ``` ## Debug Podflie with cocoapods 1. Add the cococapods to gem ```ruby gem 'cocoapods', :source => 'file://Users/qxq4633/source-code/CocoaPods' ``` 2. update cocoapods git repos ``` git submodule update --init --recursive ``` 3. add `Cocoapods` folder ref and iOS project to current work directory ``` ├── Gemfile ├── Gemfile.lock ├── README.md ├── WatchExample │ ├── Podfile │ ├── Podfile.lock │ ├── Pods │ ├── WatchExample │ ├── WatchExample.xcodeproj │ ├── WatchExample.xcworkspace │ ├── watch │ └── watch\ Extension └── main.rb ``` 4. add the debug configuration ```json { "name": "pod install", "type": "ruby-debug", "request": "launch", "program": "/Users/qxq4633/source-code/CocoaPods/bin/pod", "programArgs": [ "install", "--project-directory=/Users/qxq4633/Desktop/SwiftUI/rubyDebug/WatchExample", ], } ``` 5. click vscode `run`->`Start Debugging`, then you can add breakpoint debug the ruby functions ![call_stack](./call_stack.png) ## Related docs https://ruby-china.org/wiki/tools https://github.com/castwide/vscode-ruby-debug https://code.visualstudio.com/docs/editor/debugging https://bundler.io/v2.2/man/bundle.1.html