rebased on top of master/ updated dist files

This commit is contained in:
Artur Stolear
2020-06-10 12:53:23 +03:00
parent b5f0884321
commit e710d248d1
29 changed files with 937 additions and 1083 deletions

View File

@@ -41,7 +41,10 @@ export async function run() {
const result = await gitVersionTool.run(settings)
const { stdout } = result
const jsonOutput = stdout.substring(stdout.indexOf('{'), stdout.indexOf('}') + 1)
const jsonOutput = stdout.substring(
stdout.indexOf('{'),
stdout.indexOf('}') + 1
)
const gitversion = JSON.parse(jsonOutput) as GitVersionOutput
gitVersionTool.writeGitVersionToAgent(gitversion)

View File

@@ -109,20 +109,23 @@ export class GitVersionTool extends DotnetTool implements IGitVersionTool {
}
public writeGitVersionToAgent(gitversion: GitVersionOutput): void {
let properties = Object.keys(gitversion);
let gitversionOutput = <any> gitversion;
let properties = Object.keys(gitversion)
let gitversionOutput = <any>gitversion
properties.forEach(property => {
const name = this.toCamelCase(property)
const value = gitversionOutput[property]
this.buildAgent.setOutput(name, value);
});
this.buildAgent.setOutput(name, value)
})
}
private toCamelCase(input: string): string {
return input.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, index) {
if (+match === 0) return ""; // or if (/\s+/.test(match)) for white spaces
return index == 0 ? match.toLowerCase() : match.toUpperCase();
});
return input.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (
match,
index
) {
if (+match === 0) return '' // or if (/\s+/.test(match)) for white spaces
return index == 0 ? match.toLowerCase() : match.toUpperCase()
})
}
}