Coder Social home page Coder Social logo

chlxb / efpodsanalyzer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eyrefree/efpodsanalyzer

0.0 1.0 0.0 734 KB

CocoaPods dependency analysis tool.

Home Page: https://pypi.org/project/efpodsanalyzer/

License: GNU General Public License v3.0

Python 57.99% HTML 42.01%

efpodsanalyzer's Introduction

EFPodsAnalyzer is a Python script that is used to help us sort out the CoaoaPods library dependency relationship. It can generate clear Pods dependency graph with only one command, which will help us in dependency sorting / component cleaning.

中文介绍

Preview

The more the Pods library is, the more complex the library is, the more it is used to get the tool, for example, the modularized item; conversely, if the project dependency is very few and the dependency relation is very simple, there is no need for this tool. The dependency graph of a project of our company is as follows, looks like a shit:

Requirements

  • Python 2.7

Installation

PyPI

If you have pip installed on your device, you can install the latest version of this tool directly with the following commands:

sudo pip install efpodsanalyzer --upgrade

Manual

Download this project, or execute the following commands to Clone this project:

git clone [email protected]:EyreFree/EFPodsAnalyzer.git

Usage

PyPI

  1. First, ensure that your project has been operated on pod install and successfully generated the Pods directory;
  2. Install efpodsanalyzer on your device with pip;
  3. Classify the dependent libraries according to the specific circumstances of the projects to be analyzed, and give the regex of each category separately, then write the rules to the EFPAConfig.json file under the directory which contains the target Podfile;
  4. Execute the following commands for the generation of the dependency graph:
sudo efpodsanalyzer [Target Podfile file path]
  1. You can check the output of the terminal. If you see the following log, you can open the generated file index.html in the path with your browser:
Dependency graph generated: .../EFPADiagram/index.html

If there is any error, please deal with the corresponding error information, or you can make a PR or an Issue.

Manual

  1. First, ensure that your project has been operated on pod install and successfully generated the Pods directory;
  2. The content of this tool has been fully downloaded to the local area;
  3. Classify the dependent libraries according to the specific circumstances of the projects to be analyzed, and give the regex of each category separately, then write the rules to the EFPAConfig.json file under the directory which contains the target Podfile;
  4. Execute the following commands for the generation of the dependency graph:
python [EFPodsAnalyzer.py file path] [Target Podfile file path]
  1. You can check the output of the terminal. If you see the following log, you can open the generated file index.html in the path with your browser:
Dependency graph generated: .../EFPADiagram/index.html

If there is any error, please deal with the corresponding error information, or you can make a PR or an Issue.

Example

Here we take Coding's open source iOS client as an example to show you the complete use of this tool:

  1. First, install efpodsanalyzer on your device with pip.
  2. Then download the Coding iOS project to local, and perform pod install operation;
  3. Because the dependency of the Coding client is basically not classified, which is all the third party library. Therefore, for demonstration purposes, I divide it into three categories: the library with the beginning of 'M', the library ending with 'Kit' and the others. The EFPAConfig.json is as follows(You can also click here to see the sample file online):
{
    "config": {
        "categories": ["M-prefixed Libraries", "Library ending with Kit", "Other"],
        "categoryRegexes": ["^M.*", ".*(Kit)$", ".*"]
    }
}
  1. The command to generate diagram is as follows:
sudo efpodsanalyzer /Users/eyrefree/Documents/iOS_GitHub/Coding-iOS/Podfile
  1. The final dependency graph is generated as follows, you can also view it online:

  • Clicking on the top class name can control the display and hiding of the class;
  • The mouse can be suspended on the node to display the node name;
  • The mouse can be suspended on the line between two nodes to display the relationship of them.

Another style circular, as follows, you can view it online too:

Todo

  • Determine whether the dependency needs to be removed, according to the header file reference;
  • Determine whether the dependency needs to be removed, depending on the class dependency;
  • More style of diagrams.

Other

  1. The view of dependency graph is based on ECharts and xml2json, thanks for their work!
  2. Code of this tool can be packaged / released using the following commands. People who needs to build a custom version can make some self exploration(Under the root directory of this project):
rm -rf dist/*;
python setup.py sdist bdist_wheel;
twine upload dist/efpodsanalyzer*;

Author

EyreFree, [email protected]

License

EFPodsAnalyzer is available under the GPLv3 license. See the LICENSE file for more info.

efpodsanalyzer's People

Contributors

eyrefree avatar

Watchers

 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.