Skip to content

Commit

Permalink
template stats --experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
milesstoetzner authored Mar 7, 2024
1 parent d1391ac commit 045cc93
Show file tree
Hide file tree
Showing 20 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/docs/interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -2692,7 +2692,7 @@ collects stats of a given service template (experimental)

=== "CLI"
```shell linenums="1"
vintner template stats --template ${TEMPLATE}
vintner template stats --experimental --template ${TEMPLATE}
```

=== "cURL"
Expand Down
4 changes: 2 additions & 2 deletions examples/unfurl-artifacts/stats/stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ yarn cli template stats \
echo

echo "VDMMv1"
yarn cli template stats --template examples/unfurl-artifacts/stats/variable-service-template-v1.yaml
yarn cli template stats --experimental --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
yarn cli template stats --experimental --template examples/unfurl-artifacts/stats/variable-service-template-v2.yaml
echo
2 changes: 1 addition & 1 deletion examples/unfurl-technology-automated-counting/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/variable-service-template.yaml
yarn cli template stats --experimental --template ${PWD}/variable-service-template.yaml
2 changes: 1 addition & 1 deletion examples/unfurl-technology-automated-random/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/variable-service-template.yaml
yarn cli template stats --experimental --template ${PWD}/variable-service-template.yaml
2 changes: 1 addition & 1 deletion examples/unfurl-technology-automated-weighted/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/variable-service-template.yaml
yarn cli template stats --experimental --template ${PWD}/variable-service-template.yaml
2 changes: 1 addition & 1 deletion examples/unfurl-technology-baseline-elastic/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/variable-service-template.yaml
yarn cli template stats --experimental --template ${PWD}/variable-service-template.yaml
2 changes: 1 addition & 1 deletion examples/unfurl-technology-baseline-kubernetes/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/variable-service-template.yaml
yarn cli template stats --experimental --template ${PWD}/variable-service-template.yaml
2 changes: 1 addition & 1 deletion examples/unfurl-technology-baseline-static-large/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/variable-service-template.yaml
yarn cli template stats --experimental --template ${PWD}/variable-service-template.yaml
2 changes: 1 addition & 1 deletion examples/unfurl-technology-baseline-static/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/variable-service-template.yaml
yarn cli template stats --experimental --template ${PWD}/variable-service-template.yaml
2 changes: 1 addition & 1 deletion examples/unfurl-technology-maintenance/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/variable-service-template.yaml
yarn cli template stats --experimental --template ${PWD}/variable-service-template.yaml
2 changes: 1 addition & 1 deletion examples/unfurl-technology-manual/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/variable-service-template.yaml
yarn cli template stats --experimental --template ${PWD}/variable-service-template.yaml
2 changes: 1 addition & 1 deletion examples/xopera-pruning-consistent-loose/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/enriched.yaml
yarn cli template stats --experimental --template ${PWD}/enriched.yaml
2 changes: 1 addition & 1 deletion examples/xopera-pruning/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/enriched.yaml
yarn cli template stats --experimental --template ${PWD}/enriched.yaml
1 change: 1 addition & 0 deletions src/cli/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ template
.command('stats')
.description('collects stats of a given service template (experimental)')
.requiredOption('--template <strings...>', 'path to service template')
.requiredOption('--experimental', 'enable experimental feature')
.action(
hae.exit(async options => {
const result = await Controller.template.stats(options)
Expand Down
2 changes: 2 additions & 0 deletions src/controller/template/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as utils from '#utils'

export type TemplateStatsOptions = {
template: string[]
experimental: boolean
}

export type TemplateStats = {
Expand All @@ -31,6 +32,7 @@ export type TemplateStats = {

export default async function (options: TemplateStatsOptions) {
assert.isDefined(options.template, 'Template not defined')
assert.isTrue(options.experimental)

// TODO: count technologies encoded in node type

Expand Down
4 changes: 4 additions & 0 deletions src/utils/assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export function isBoolean(element: unknown): asserts element is boolean {
if (!check.isBoolean(element)) throw new Error(`Element "${utils.stringify(element)}" is not a boolean`)
}

export function isTrue(element: unknown): asserts element is true {
if (!check.isTrue(element)) throw new Error(`Element "${utils.stringify(element)} is not "true"`)
}

export function isStatement(boolean: boolean, msg: string) {
if (!boolean) throw new Error(msg)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/pruning-modes/01-manual/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/enriched.yaml
yarn cli template stats --experimental --template ${PWD}/enriched.yaml
2 changes: 1 addition & 1 deletion tests/pruning-modes/02-consistent-strict/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/enriched.yaml
yarn cli template stats --experimental --template ${PWD}/enriched.yaml
2 changes: 1 addition & 1 deletion tests/pruning-modes/04-default/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/enriched.yaml
yarn cli template stats --experimental --template ${PWD}/enriched.yaml
2 changes: 1 addition & 1 deletion tests/pruning-modes/05-semantic-strict/stats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
set -e

yarn cli template stats --template ${PWD}/enriched.yaml
yarn cli template stats --experimental --template ${PWD}/enriched.yaml

0 comments on commit 045cc93

Please sign in to comment.