|
|
@ -1,7 +1,7 @@ |
|
|
|
# powershell 脚本,等待输入ID |
|
|
|
$Type = Read-Host "input deploy type(api/web):" |
|
|
|
$Type = Read-Host "input deploy type(api/web/service):" |
|
|
|
# 如果输入不是api或者web,则退出 |
|
|
|
if ($Type -ne "api" -and $Type -ne "web") { |
|
|
|
if ($Type -ne "api" -and $Type -ne "web" -and $Type -ne "service") { |
|
|
|
Write-Host "error, input must be api or web" |
|
|
|
exit |
|
|
|
} |
|
|
@ -28,9 +28,12 @@ Invoke-WebRequest https://gitea.gxxhygroup.com/dark/gotools/raw/branch/master/re |
|
|
|
|
|
|
|
# 获取swagger.bat, |
|
|
|
Invoke-WebRequest https://gitea.gxxhygroup.com/dark/gotools/raw/branch/master/swagger.bat -o swagger.bat |
|
|
|
# 使用文件名替换swagger.bat中的HostNameForReplace |
|
|
|
$files | ForEach-Object { (Get-Content 'swagger.bat') -replace 'HostNameForReplace', $_ | Set-Content 'swagger.bat' } |
|
|
|
# $files去除字符串中的-,赋值给变量 |
|
|
|
$filesjson = $files -replace '-', '' |
|
|
|
# 再去除字符串最后的api或者web |
|
|
|
$filesjson = $filesjson -replace 'api', '' |
|
|
|
# 使用新文件名替换swagger.bat中的Name-For-Replace |
|
|
|
$filesjson | ForEach-Object { (Get-Content 'swagger.bat') -replace 'Name-For-Replace', $_ | Set-Content 'swagger.bat' } |
|
|
|
# |
|
|
|