Merge pull request #814 from GitTools/feature/691
This commit is contained in:
@@ -4,13 +4,13 @@ import * as path from 'path'
|
||||
import * as http from 'typed-rest-client/HttpClient'
|
||||
|
||||
import { inject, injectable } from 'inversify'
|
||||
import { TYPES, IExecResult, IBuildAgent } from './models'
|
||||
import { IBuildAgent, IExecResult, TYPES } from './models'
|
||||
import { IVersionManager } from './versionManager'
|
||||
import { ISetupSettings } from '../tools/common/models'
|
||||
|
||||
export interface IDotnetTool {
|
||||
disableTelemetry(): void
|
||||
toolInstall(toolName: string, checkLatest: boolean, setupSettings: ISetupSettings): Promise<string>
|
||||
toolInstall(toolName: string, setupSettings: ISetupSettings): Promise<string>
|
||||
}
|
||||
|
||||
@injectable()
|
||||
@@ -37,13 +37,14 @@ export class DotnetTool implements IDotnetTool {
|
||||
return this.buildAgent.exec(cmd, args)
|
||||
}
|
||||
|
||||
public async toolInstall(toolName: string, checkLatest: boolean, setupSettings: ISetupSettings): Promise<string> {
|
||||
public async toolInstall(toolName: string, setupSettings: ISetupSettings): Promise<string> {
|
||||
console.log('')
|
||||
console.log('--------------------------')
|
||||
console.log(`Acquiring ${toolName} version spec: ${setupSettings.versionSpec}`)
|
||||
console.log('--------------------------')
|
||||
|
||||
let version: string
|
||||
let checkLatest = setupSettings.preferLatestVersion
|
||||
if (this.versionManager.isExplicitVersion(setupSettings.versionSpec)) {
|
||||
checkLatest = false // check latest doesn't make sense when explicit version
|
||||
version = setupSettings.versionSpec
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
export enum SetupFields {
|
||||
includePrerelease = 'includePrerelease',
|
||||
versionSpec = 'versionSpec',
|
||||
ignoreFailedSources = 'ignoreFailedSources'
|
||||
ignoreFailedSources = 'ignoreFailedSources',
|
||||
preferLatestVersion = 'preferLatestVersion'
|
||||
}
|
||||
|
||||
export interface ISetupSettings {
|
||||
[SetupFields.versionSpec]: string
|
||||
[SetupFields.includePrerelease]: boolean
|
||||
[SetupFields.ignoreFailedSources]: boolean
|
||||
[SetupFields.preferLatestVersion]: boolean
|
||||
}
|
||||
|
||||
export interface ISettingsProvider {
|
||||
|
||||
@@ -10,11 +10,13 @@ export class SettingsProvider implements ISettingsProvider {
|
||||
const versionSpec = this.buildAgent.getInput(SetupFields.versionSpec)
|
||||
const includePrerelease = this.buildAgent.getBooleanInput(SetupFields.includePrerelease)
|
||||
const ignoreFailedSources = this.buildAgent.getBooleanInput(SetupFields.ignoreFailedSources)
|
||||
const preferLatestVersion = this.buildAgent.getBooleanInput(SetupFields.preferLatestVersion)
|
||||
|
||||
return {
|
||||
versionSpec,
|
||||
includePrerelease,
|
||||
ignoreFailedSources
|
||||
ignoreFailedSources,
|
||||
preferLatestVersion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export class GitReleaseManagerTool extends DotnetTool implements IGitReleaseMana
|
||||
}
|
||||
|
||||
public async install(setupSettings: ISetupSettings): Promise<void> {
|
||||
await this.toolInstall('GitReleaseManager.Tool', false, setupSettings)
|
||||
await this.toolInstall('GitReleaseManager.Tool', setupSettings)
|
||||
}
|
||||
|
||||
public create(settings: GitReleaseManagerCreateSettings): Promise<IExecResult> {
|
||||
|
||||
@@ -18,7 +18,7 @@ export class GitVersionTool extends DotnetTool implements IGitVersionTool {
|
||||
}
|
||||
|
||||
public async install(setupSettings: ISetupSettings): Promise<void> {
|
||||
await this.toolInstall('GitVersion.Tool', false, setupSettings)
|
||||
await this.toolInstall('GitVersion.Tool', setupSettings)
|
||||
}
|
||||
|
||||
public run(options: GitVersionSettings): Promise<IExecResult> {
|
||||
@@ -149,7 +149,7 @@ export class GitVersionTool extends DotnetTool implements IGitVersionTool {
|
||||
}
|
||||
|
||||
private toCamelCase(input: string): string {
|
||||
return input.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) {
|
||||
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