-
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
1 parent
02b39bd
commit d704078
Showing
17 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,23 @@ | ||
#!/usr/bin/env sh | ||
set -e | ||
|
||
echo "TOSCA" | ||
yarn cli template stats \ | ||
--template examples/unfurl-artifacts/.stats/service-template-business-de.yaml \ | ||
--template examples/unfurl-artifacts/.stats/service-template-business-en.yaml \ | ||
--template examples/unfurl-artifacts/.stats/service-template-business-es.yaml \ | ||
--template examples/unfurl-artifacts/.stats/service-template-community-de.yaml \ | ||
--template examples/unfurl-artifacts/.stats/service-template-community-en.yaml \ | ||
--template examples/unfurl-artifacts/.stats/service-template-community-es.yaml \ | ||
--template examples/unfurl-artifacts/.stats/service-template-enterprise-de.yaml \ | ||
--template examples/unfurl-artifacts/.stats/service-template-enterprise-en.yaml \ | ||
--template examples/unfurl-artifacts/.stats/service-template-enterprise-es.yaml | ||
echo | ||
|
||
echo "VDMMv1" | ||
yarn cli template stats --template examples/unfurl-artifacts/.stats/variable-service-template-v1.yaml | ||
echo | ||
|
||
echo "VDMMv2" | ||
yarn cli template stats --template examples/unfurl-artifacts/.stats/variable-service-template-v2.yaml | ||
echo |
File renamed without changes.
File renamed without changes.
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
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,48 @@ | ||
import * as files from '#files' | ||
import Graph from '#graph/graph' | ||
import {ServiceTemplate} from '#spec/service-template' | ||
import * as utils from '#utils' | ||
import * as validator from '#validator' | ||
|
||
export type TemplateStatsOptions = { | ||
template: string[] | ||
} | ||
|
||
export type TemplateStats = { | ||
nodes: number | ||
relations: number | ||
properties: number | ||
types: number | ||
policies: number | ||
groups: number | ||
inputs: number | ||
artifacts: number | ||
imports: number | ||
elements: number | ||
// Nodes + Relations + Properties + Artifacts | ||
nrpa: number | ||
} | ||
|
||
export default async function (options: TemplateStatsOptions) { | ||
if (validator.isUndefined(options.template)) throw new Error(`Template not defined`) | ||
|
||
return utils.sumObjects( | ||
options.template.map(it => { | ||
const graph = new Graph(files.loadYAML<ServiceTemplate>(it)) | ||
const stats: TemplateStats = { | ||
nodes: graph.nodes.length, | ||
relations: graph.relations.length, | ||
properties: graph.properties.length, | ||
types: graph.types.length, | ||
policies: graph.types.length, | ||
groups: graph.groups.length, | ||
inputs: graph.inputs.length, | ||
artifacts: graph.artifacts.length, | ||
imports: graph.artifacts.length, | ||
elements: graph.elements.length, | ||
nrpa: graph.nodes.length + graph.relations.length + graph.properties.length + graph.artifacts.length, | ||
} | ||
return stats | ||
}) | ||
) | ||
} |
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