-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ricardo Pescuma Domenecci
committed
Oct 26, 2022
1 parent
df569b6
commit 6494ec7
Showing
39 changed files
with
49,836 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
### Go ### | ||
|
||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
# Go Patch | ||
/vendor/ | ||
/Godeps/ | ||
|
||
|
||
### macOS ### | ||
|
||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### macOS Patch ### | ||
# iCloud generated files | ||
*.icloud | ||
|
||
|
||
### Others ### | ||
build/ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,126 @@ | ||
# archer | ||
Get help understanding your architecture. | ||
|
||
Please keep in mind that this is a work in progress, but it's already useful. | ||
|
||
## Workspace | ||
To use it, first you need to import the information into a workspace, than | ||
you can query and show graphs from it. | ||
|
||
A workspace can be set using the `-w` cli arg. Default is `./.archer` (if it exists) or `~/.archer`. | ||
|
||
## Roots and projects | ||
|
||
archer work with the idea of roots and projects. A project is a groping of source files or a | ||
table, for ex, depending on the importer. | ||
|
||
A root is a groping of projects and allows to relate information from different sources. | ||
|
||
## Importing information | ||
|
||
### From gradle | ||
|
||
Run | ||
``` | ||
archer import gradle <root of your gradle project(s)> | ||
``` | ||
|
||
All the projects will be imported. The root name is the name of the root gradle project. | ||
|
||
|
||
### From hibernate | ||
|
||
Run | ||
``` | ||
archer import hibernate <source paths> --root <root name> | ||
``` | ||
|
||
Imports hibernate configuration from files inside the source paths. Currently only | ||
kotlin files are supported, and information is gathered from annotations. | ||
|
||
The `source paths` can be a path on disk or a query (see below). | ||
|
||
The `root name` is required in this case and should be the schema name where the tables live. | ||
|
||
You can also use `--glob` to filter which files should be parsed. For ex: `--glob '**/Db*.kt'`. | ||
|
||
|
||
### From MySQL | ||
|
||
Run | ||
``` | ||
archer import mysql <connection string> | ||
``` | ||
|
||
The `connection string` format is defined [here](https://github.com/go-sql-driver/mysql#dsn-data-source-name). | ||
|
||
All tables will be imported. The root name is the schema name. | ||
|
||
|
||
## Configuring things | ||
|
||
You can use `archer config set` to add information to the projects. | ||
Currently these are supported: | ||
- ignore: does not output this project | ||
- color: fixes the color to be used in graphs | ||
|
||
|
||
## Showing data | ||
|
||
### Textual output | ||
|
||
Run | ||
``` | ||
archer show | ||
``` | ||
|
||
### Graphs | ||
|
||
For this you need to have [graphviz dot](https://graphviz.org/) installed and in your path. | ||
|
||
Run | ||
``` | ||
archer graph -o <output file.extension> | ||
``` | ||
|
||
### Selecting what to see | ||
|
||
The simple version of the commands show all information available. This is usually too much, so | ||
there are some parameters/filters to select what should be show. | ||
|
||
#### `-r <name>` | ||
Only show information from one root | ||
|
||
### '-i <query>' | ||
Only show information that matches the query (see below) | ||
|
||
### '-e <query>' | ||
Don't show information that matches the query (see below) | ||
|
||
## Queries | ||
|
||
Queries allows you to select which projects are interesting. The supported formats are: | ||
|
||
### Project query: `<root name>:<project name>` or `<project name>` or `<project simple name>` | ||
You can use `*` inside there to avoid some typing. | ||
|
||
### Any dependency query: `<project 1 query> -> <project 2query>` | ||
Shows any dependency chain that links project 1 to project 2 | ||
|
||
### Max steps dependency query: `<project 1 query> -N-> <project 2query>` | ||
`N` is a number. | ||
|
||
Shows any dependency chain that links project 1 to project 2, with at most N hops. | ||
|
||
### Invert query: `not:<query>` | ||
Inverts the matching. | ||
|
||
### Multiple matches required: `<query> & <query>` | ||
To do an OR just pass different `-i` arguments. | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//go:build ignore | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/pescuma/go-build" | ||
) | ||
|
||
func main() { | ||
cfg := build.NewBuilderConfig() | ||
cfg.Archs = []string{"darwin"} | ||
|
||
b, err := build.NewBuilder(cfg) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
err = b.RunTarget("all") | ||
if err != nil { | ||
panic(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package main | ||
|
||
import "github.com/Faire/archer/lib/archer" | ||
|
||
type cmdWithFilters struct { | ||
Root []string `short:"r" help:"Only show projects from this root(s)."` | ||
Include []string `short:"i" help:"Filter which projects or dependencies are shown."` | ||
Exclude []string `short:"e" help:"Filter which projects or dependencies are NOT shown. This has preference over the included ones."` | ||
} | ||
|
||
func (c *cmdWithFilters) createFilter(projs *archer.Projects) (archer.Filter, error) { | ||
var filters []archer.Filter | ||
|
||
for _, f := range c.Include { | ||
fi, err := archer.ParseFilter(projs, f, archer.Include) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
filters = append(filters, fi) | ||
} | ||
|
||
for _, f := range c.Exclude { | ||
fi, err := archer.ParseFilter(projs, f, archer.Exclude) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
filters = append(filters, fi) | ||
} | ||
|
||
filters = append(filters, archer.CreateIgnoreFilter()) | ||
|
||
if len(c.Root) > 0 { | ||
f, err := archer.CreateRootsFilter(c.Root) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
filters = append(filters, f) | ||
} | ||
|
||
return archer.GroupFilters(filters...), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/Faire/archer/lib/archer" | ||
) | ||
|
||
type ConfigSetCmd struct { | ||
Project string `arg:"" help:"Project filter to configure."` | ||
Config string `arg:"" help:"Configuration name to change."` | ||
Value string `arg:"" help:"Configuration value to set."` | ||
} | ||
|
||
func (c *ConfigSetCmd) Run(ctx *context) error { | ||
projects, err := ctx.ws.LoadProjects() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
filter, err := archer.ParseFilter(projects, c.Project, archer.Include) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
for _, p := range projects.ListProjects(archer.FilterExcludeExternal) { | ||
if filter.FilterProject(p) != archer.Include { | ||
continue | ||
} | ||
|
||
fmt.Printf("Seting '%v' '%v' = '%v'\n", p.Name, c.Config, c.Value) | ||
|
||
_, err := ctx.ws.SetConfigParameter(p, c.Config, c.Value) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.