github.com/ezbuy/gauge@v0.9.4-0.20171013092048-7ac5bd3931cd/build/run.ps1 (about)

     1  # Copyright 2015 ThoughtWorks, Inc.
     2  
     3  # This file is part of Gauge.
     4  
     5  # Gauge is free software: you can redistribute it and/or modify
     6  # it under the terms of the GNU General Public License as published by
     7  # the Free Software Foundation, either version 3 of the License, or
     8  # (at your option) any later version.
     9  
    10  # Gauge is distributed in the hope that it will be useful,
    11  # but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  # GNU General Public License for more details.
    14  
    15  # You should have received a copy of the GNU General Public License
    16  # along with Gauge.  If not, see <http://www.gnu.org/licenses/>.
    17  
    18  param (
    19      [Parameter(Mandatory=$true)][string]$task = "build"
    20  )
    21  
    22  function checkLasterror {
    23      if ($LastExitCode -ne 0) {
    24          exit $LastExitCode
    25      }
    26  }
    27  
    28  function build {
    29      & go run build/make.go
    30      checkLasterror
    31  }
    32  
    33  function test {
    34      & go test .\... -v
    35      checkLasterror
    36  }
    37  
    38  if ("$env:GOPATH" -eq "") {
    39      $env:GOPATH=$pwd
    40  }
    41  if ("$env:GOBIN" -eq "") {
    42      $env:GOBIN="$env:GOPATH\bin"
    43  }
    44  
    45  Set-Location -Path "$env:GOPATH\src\github.com\getgauge\gauge"
    46  
    47  go get github.com/tools/godep 
    48  & "$env:GOBIN\godep.exe" "restore"
    49  
    50  checkLasterror
    51  
    52  switch ($task) {
    53      "test" { 
    54          test
    55      }
    56      Default {
    57          build
    58      }
    59  }