Coder Social home page Coder Social logo

applemini / debug_cocoapods_plugins_in_vscode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from x140yu/debug_cocoapods_plugins_in_vscode

0.0 0.0 0.0 2.7 MB

Home Page: https://zxy.vercel.app/debug-cocoapods-with-vscode

Shell 0.05% Ruby 98.47% Python 0.44% Objective-C 0.03% Swift 1.00%

debug_cocoapods_plugins_in_vscode's Introduction

Debug CocoaPods & Plugins in VSCode

中文版本点这里

使用 VSCode debug CocoaPods 和插件源码

Debug cocoapods

Debug plugin

Pre-requirements

Install Debug Gems

gem install ruby-debug-ide
gem install debase

Install VSCode Ruby Plugin

Ruby

Debug With bundler

  • Create a Gemfile in project root and add the following content to it
gem 'cocoapods', path: 'path/to/cocoapods/'
gem 'cocoapods-binary', path: 'path/to/cocoapods-binary/'
gem 'ruby-debug-ide'
gem 'debase'
  • run bundle install
  • Create .vscode/launch.json in project root
{
  "configurations": [{
      "name": "Debug CocoaPods Plugin with Bundler",
      "showDebuggerOutput": true,
      "type": "Ruby",
      "request": "launch",
      "useBundler": true,
      "cwd": "${workspaceRoot}/Testing",
      "program": "${workspaceRoot}/cocoapods/bin/pod",
      "args": ["install"]
    }
}
  • Add some breakpoint within VSCode
  • Press F5 or hit menu Debug - Start Debugging

Debug without bundler

Don't waste your time! Use bundler now!

Debug CocoaPods

git clone https://github.com/CocoaPods/CocoaPods.git
  • Checkout cloned repo to match the version you have installed on your laptop
git checkout `pod --version`
  • Create .vscode/launch.json in CocoaPods' root folder
{
  "configurations": [{
    "name": "Debug CocoaPods Plugin",
    "showDebuggerOutput": true,
    "type": "Ruby",
    "request": "launch",
    "cwd": "path/to/podfile/dir", // where the `pod` command execute (the folder should contain a `Podfile`)
    "program": "${workspaceRoot}/bin/pod",
    "args": ["install"] // `pod` command arguments
  }]
}
  • Comment bin/pod:L27 (# require 'bundler/setup')
  • Add some breakpoint within VSCode
  • Press F5 or hit menu Debug - Start Debugging

Debug CocoaPods & plugin

  • Create a new folder, all actions below are under this folder
  • Clone & checkout CocoaPods source code
  • Clone or create a CocoaPods plugin
  • Copy .vscode to this folder
  • Make some changes in .vscode/launch.json
    • cwd: where the pod command execute (the folder should contain a Podfile)
    • pluginPath: path to the plugin
    • args: pod command arguments
  • Change cocoapods/bin/pod:L27
    • From require 'bundler/setup to require_relative '../../.vscode/plugin_patch', just like this
  • Add some breakpoint within VSCode
  • Press F5 or hit menu Debug - Start Debugging

Example of debugging CocoaPods & plugin

The CocoaPods version in this repository is 1.8.0.beta.1, incase some version incompatible issue with CocoaPods-Core or other gems, you should install this version's CocoaPods in your Mac too

  • Clone this repository
  • Open it with VSCode
  • Add a breakpoint somewhere you like to explore
    • eg. cocoapods/lib/cocoapods/command/install.rb:L46
    • eg. cocoapods-binary/lib/cocoapods-binary/Main.rb:L101
  • Press F5 or hit menu Debug - Start Debugging
  • All set 🌸

If you have any question, don't hesitate to fire a issue 😉

Appreciate a 🌟 if you like it.

debug_cocoapods_plugins_in_vscode's People

Contributors

x140yu avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.