-
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.
Merge pull request #57 from owulveryck/refacto
Refacto
- Loading branch information
Showing
10 changed files
with
1,423 additions
and
95 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,126 @@ | ||
This sample code: | ||
|
||
```cue | ||
package main | ||
import ( | ||
"github.com/owulveryck/cue4puml4c4/technology/gcp" | ||
"github.com/owulveryck/cue4puml4c4/technology/dev" | ||
"github.com/owulveryck/cue4puml4c4/technology/stdlib" | ||
"github.com/owulveryck/cue4puml4c4:c4" | ||
) | ||
// Tags | ||
elementsTags: [ID=_]: c4.#ElementTag & { | ||
id: "\(ID)" | ||
} | ||
relationsTags: [ID=_]: c4.#RelationTag & { | ||
id: "\(ID)" | ||
} | ||
elementsTags: aSupprimer: { | ||
legendText: "A Migrer en React" | ||
bgColor: "#f0239c" | ||
borderColor: "#ff0239c" | ||
technology: dev.React | ||
shadowing: true | ||
shape: "eightsided" | ||
} | ||
relationsTags: myTest: {lineStyle: "bold"} | ||
relationsTags: autreFleche: {lineColor: "#ff0000"} | ||
// Containers | ||
myWebApp: c4.#Container & { | ||
id: "web_appp" | ||
label: "Web Application" | ||
description: "Allows users to compare multiple Twitter timelines" | ||
technology: dev.CUE | ||
tags: [elementsTags.aSupprimer] | ||
} | ||
myothercontainer: c4.#Container & { | ||
id: "othercontainer" | ||
label: "Cool2" | ||
technology: stdlib.Kafka | ||
} | ||
othersample: c4.#Container & { | ||
id: "sample2" | ||
label: "Twitter2" | ||
technology: gcp.Pubsub | ||
link: "https://www.twitter.com" | ||
} | ||
twitter: c4.#System & { | ||
id: "twitter" | ||
label: "Twitter" | ||
technology: gcp.Vertexai | ||
link: "https://www.twitter.com" | ||
} | ||
sampleSystem: c4.#System & { | ||
id: "c1" | ||
label: "Sample System" | ||
containers: [myWebApp, othersample, myothercontainer] | ||
technology: gcp.CloudSql | ||
systems: [twitter] | ||
} | ||
admin: c4.#Person & { | ||
id: "admin" | ||
label: "Administrator" | ||
} | ||
C1: c4.#C1 & { | ||
elementTags: elementsTags | ||
relationTags: relationsTags | ||
Persons: [admin] | ||
Systems: [sampleSystem] | ||
Relations: [ | ||
{source: admin, dest: myWebApp, description: "Uses", protocol: "HTTPS ", tags: [relationsTags.myTest]}, | ||
{source: myWebApp, dest: twitter, description: "Get tweets from", protocol: "HTTPS ", link: "https://plantuml.com/link"}, | ||
] | ||
} | ||
``` | ||
|
||
Generates this plantuml file: | ||
|
||
```plantuml | ||
@startuml MyName | ||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml | ||
!include https://raw.githubusercontent.com/owulveryck/PlantUML-icons-GCP/master/official/GCPCommon.puml | ||
!include https://raw.githubusercontent.com/owulveryck/cue4puml4c4/main/assets/cue.puml | ||
!include https://raw.githubusercontent.com/owulveryck/PlantUML-icons-GCP/master/official/cloud_sql/cloud_sql.puml | ||
!include https://raw.githubusercontent.com/owulveryck/PlantUML-icons-GCP/master/official/pubsub/pubsub.puml | ||
!include https://raw.githubusercontent.com/owulveryck/PlantUML-icons-GCP/master/official/vertexai/vertexai.puml | ||
!include https://raw.githubusercontent.com/plantuml-stdlib/gilbarbara-plantuml-sprites/master/sprites/./kafka.puml | ||
/'Relation Tags'/ | ||
AddRelTag("autreFleche",$lineColor="#ff0000") | ||
AddRelTag("myTest",$lineStyle=BoldLine()) | ||
/'Element Tags'/ | ||
AddElementTag("aSupprimer",$bgColor="#f0239c",$borderColor="#ff0239c",$shadowing="true",$shape="EightSidedShape()",$legendText="A Migrer en React",$techn="React",$sprite="react") | ||
/' Persons '/ | ||
Person(admin,"Administrator") | ||
/' Systems '/ | ||
System(c1,"Sample System","Google Cloud Sql","cloud_sql"){ | ||
Container(web_appp,"Web Application","CUE","Allows users to compare multiple Twitter timelines","cue_logo",$tags="aSupprimer+ ") | ||
ContainerQueue(sample2,"Twitter2","Google Pubsub","","pubsub",$link="https://www.twitter.com") | ||
Container(othercontainer,"Cool2","Kafka","","kafka") | ||
System(twitter,"Twitter","Google Vertexai","vertexai",$link="https://www.twitter.com") | ||
} | ||
/' Relations '/ | ||
Rel("admin","web_appp","Uses","HTTPS ",$tags="myTest+ ") | ||
Rel("web_appp","twitter","Get tweets from","HTTPS ",$link="https://plantuml.com/link") | ||
SHOW_LEGEND() | ||
@enduml | ||
``` | ||
|
||
Which give this picture: | ||
|
||
![](sample.svg) |
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,94 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/owulveryck/cue4puml4c4/technology/gcp" | ||
"github.com/owulveryck/cue4puml4c4/technology/aws" | ||
"github.com/owulveryck/cue4puml4c4/technology/dev" | ||
"github.com/owulveryck/cue4puml4c4/technology/stdlib" | ||
"github.com/owulveryck/cue4puml4c4:c4" | ||
) | ||
|
||
aSupprimer: c4.#ElementTag & { | ||
id: "aSupprimer" | ||
legendText: "Rebuild in Rust" | ||
bgColor: "#f0235c" | ||
borderColor: "#ff0239c" | ||
technology: dev.Rust | ||
shadowing: true | ||
shape: "eightsided" | ||
} | ||
myTest: c4.#RelationTag & {id: "myTest", lineStyle: "bold"} | ||
autreFleche: c4.#RelationTag & {id: "autreFleche", lineColor: "#ff0000"} | ||
|
||
// Containers | ||
|
||
appEngine: c4.#System & { | ||
id: "appEngine" | ||
label: "App Engine" | ||
technology: gcp.AppEngine | ||
containers: [myWebApp] | ||
} | ||
|
||
myWebApp: c4.#Container & { | ||
id: "web_appp" | ||
label: "Web Application" | ||
description: """ | ||
Allows users | ||
to compare multiple Twitter timelines | ||
""" | ||
technology: dev.Go | ||
tags: [aSupprimer] | ||
} | ||
|
||
mysample2: c4.#Container & { | ||
id: "mysample2" | ||
label: "mysample2" | ||
description: "mysample2" | ||
technology: aws.EC2 | ||
} | ||
myothercontainer: c4.#Container & { | ||
id: "othercontainer" | ||
label: "Cool2" | ||
technology: stdlib.Kafka | ||
} | ||
|
||
othersample: c4.#Container & { | ||
id: "sample2" | ||
label: "Event Source" | ||
technology: gcp.Pubsub | ||
link: "https://www.twitter.com" | ||
} | ||
|
||
twitter: c4.#System & { | ||
id: "twitter" | ||
label: "Twitter" | ||
technology: gcp.ComputeEngine | ||
link: "https://www.twitter.com" | ||
containers: [{ | ||
id: "myDatabase" | ||
technology: dev.Postgresql | ||
label: "My Awesome DB" | ||
}] | ||
} | ||
|
||
sampleSystem: c4.#System & { | ||
id: "c1" | ||
label: "Sample System" | ||
isBoundary: true | ||
containers: [myWebApp] | ||
} | ||
|
||
admin2: c4.#Person & { | ||
id: "admin2" | ||
label: "Administrator" | ||
} | ||
|
||
admin: c4.#Person & { | ||
id: "admin" | ||
label: "Administrator" | ||
} | ||
|
||
C1: c4.#C1 & { | ||
Persons: [admin] | ||
Systems: [sampleSystem] | ||
} |
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,25 @@ | ||
package main | ||
|
||
import ( | ||
"tool/cli" | ||
"text/template" | ||
// "tool/file" | ||
"github.com/owulveryck/cue4puml4c4:c4" | ||
) | ||
|
||
command: genpuml: { | ||
c1: cli.Print & { | ||
//text: template.Execute(_plantUMLC4Template.contents, C1) | ||
text: template.Execute(c4.plantumlTemplate, C1) | ||
} | ||
} | ||
command: genmermaid: { | ||
c1: cli.Print & { | ||
//text: template.Execute(_plantUMLC4Template.contents, C1) | ||
text: template.Execute(c4.mermaidTemplate, C1) | ||
} | ||
} | ||
//_plantUMLC4Template: file.Read & { | ||
// filename: "plantuml_c4.tmpl" | ||
// contents: string | ||
//} |
Oops, something went wrong.