Commit 1809f62e by 据说甜蜜呢

添加方法

parent 947090aa
...@@ -32,3 +32,12 @@ function FirstCharUpperCase() ...@@ -32,3 +32,12 @@ function FirstCharUpperCase()
declare output=($(echo ${input} | sed -e "s/\b\(.\)/\u\1/g")) declare output=($(echo ${input} | sed -e "s/\b\(.\)/\u\1/g"))
eval $2=${output} eval $2=${output}
} }
function Substr()
{
declare input=$1
declare start=$2
declare length=$3
declare output=${input:start:length}
eval $4=${output}
}
\ No newline at end of file
...@@ -82,6 +82,31 @@ function GetVersion() ...@@ -82,6 +82,31 @@ function GetVersion()
eval $1="${major}.${minor}.${patch}" eval $1="${major}.${minor}.${patch}"
} }
function GetNumericVersion()
{
declare major=($(grep -oP '(?<=Major>)[^<]+' "./devops/version.props"))
declare minor=($(grep -oP '(?<=Minor>)[^<]+' "./devops/version.props"))
declare patch=($(grep -oP '(?<=Patch>)[^<]+' "./devops/version.props"))
eval $1=${major}${minor}${patch}
}
function GetRollBackVersion()
{
GetNumericVersion currentVersion
declare step=($(grep -oP '(?<=RollBackStep>)[^<]+' "devops/deploy.props"))
declare rollbackVersion=`expr $currentVersion - $step`
declare versionStr=""
if [ "$rollbackVersion" -lt "100" ]
then
versionStr="0.${rollbackVersion:0:1}.${rollbackVersion:1:1}"
else
versionStr="${rollbackVersion:0:1}.${rollbackVersion:1:1}.${rollbackVersion:2:1}"
fi
eval $1=${versionStr}
}
function GetImageRegistrySettings() function GetImageRegistrySettings()
{ {
declare host=($(grep -oP '(?<=ImageRegistryHost>)[^<]+' "devops/deploy.props")) declare host=($(grep -oP '(?<=ImageRegistryHost>)[^<]+' "devops/deploy.props"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment