github.com/jasonkeene/cli@v6.14.1-0.20160816203908-ca5715166dfb+incompatible/bin/replace-sha.ps1 (about)

     1  $APP_CONST_FILE = $(split-path $MyInvocation.MyCommand.Definition) + "\..\cf\app_constants.go"
     2  $APP_CONST_FILE_TMP = $APP_CONST_FILE + ".tmp"
     3  $CURRENT_SHA = $(git rev-parse --short HEAD)
     4  $CURRENT_VERSION = get-content VERSION
     5  $VERSION_STRING = $CURRENT_VERSION + "+" + $CURRENT_SHA
     6  $DATE = Get-Date -uformat "%Y-%m-%d"
     7  
     8  get-content $APP_CONST_FILE | %{$_ -replace "BUILT_FROM_SOURCE", $VERSION_STRING} | Out-File -Encoding "UTF8" $APP_CONST_FILE_TMP
     9  mv -Force $APP_CONST_FILE_TMP $APP_CONST_FILE
    10  
    11  get-content $APP_CONST_FILE | %{$_ -replace "BUILT_AT_UNKNOWN_TIME", $DATE} | Out-File -Encoding "UTF8" $APP_CONST_FILE_TMP
    12  mv -Force $APP_CONST_FILE_TMP $APP_CONST_FILE