rebased on top of master/ updated dist files
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user