项目作者: inherd

项目描述 :
将多种语言转换为 UML 模型。Modeling is a tools to analysis different languages by Ctags
高级语言: Rust
项目地址: git://github.com/inherd/modeling.git
创建时间: 2021-05-02T06:27:41Z
项目社区:https://github.com/inherd/modeling

开源协议:Other

下载


Modeling

crates.io
docs.rs
license

Modeling is a tools to analysis different languages by Ctags

process:

  1. analysis ctags
    • generate to opt
    • call ctags with opt
    • analysis ctags logs by regex
  2. generate results
  3. visual result with visualing (optional)

language support:

  • Java
  • C#
  • Cpp
  • TypeScript
  • Golang
  • Rust
  • … others by ctags

Usage

  • modeling, generate model from source code.
  • concepting, generate concepts from source code.
  • visualing, visualization the uml.
  1. Modeling 0.6.2
  2. USAGE:
  3. modeling [FLAGS] [OPTIONS]
  4. FLAGS:
  5. -b, --by-modules multiple modules
  6. -d, --debug output debug information
  7. -f, --field-only only load field in methods
  8. -h, --help Prints help information
  9. --inline-id-suffix if class's prop end with Id and class in list, will replace `int` type to `xxClass`
  10. -m, --merge merge for same method name
  11. -V, --version Prints version information
  12. --without-impl-suffix if class's prop start with `IRepository` will become `Repository`
  13. --without-parent without class inheritance
  14. OPTIONS:
  15. -g, --grep <grep> by grep regex rules: for example: `.*Service` [default: ]
  16. -i, --input <input> input dir [default: .]
  17. -o, --output-type <output-type> support: puml, mermaid, graphviz with json [default: puml]
  18. -p, --packages <packages>... filter by packages, like: `com.phodal.modeling`
  19. -s, --suffixes <suffixes>... filter by suffixes, like: `java` for .java file
  20. --without-suffix <without-suffix> remove specify suffix by text, for example `DemoDto` with be `Demo` [default: ]

sample: Grep with MVC

  1. modeling --input=/youpath/ --field-only --without-parent --grep ".*Service|.*Controller|.*Repository"

sample: with Graphviz and Visualization

with --output-type=graphviz

  1. modeling --input=/youpath --field-only -o graphviz --without-impl-suffix

sample: puml to Image

convert to image: plantuml modeling.puml modeling.svg -tsvg

with Visualization

PS: need to set --output-type graphviz, in order to generate output.json file

  1. modeling -i youpath -o graphviz
  2. visualing

Library

  1. cargo install modeling
  2. modeling .

Library

  1. use modeling::{by_dir};
  2. use modeling::render::PlantUmlRender;
  3. let classes = by_dir("src/");
  4. let puml = PlantUmlRender::render(&classes);

output sample:

  1. @startuml
  2. class Animal {
  3. + string name
  4. + string constructor()
  5. +move()
  6. }
  7. class Horse extends Animal {
  8. +move()
  9. }
  10. class Snake extends Animal {
  11. +move()
  12. }
  13. @enduml

License

ctags analysis based on https://github.com/dalance/ptags with MIT, see in src

ctags parser rewrite from Golang’s https://github.com/ruben2020/tags2uml with Apache License.

@ 2020~2021 This code is distributed under the MIT license. See LICENSE in this directory.