Short-circuit `TestCommand()` calls once commands are installed locally

This commit is contained in:
Doug Bunting 2015-01-27 10:24:45 -08:00
parent 56f45e0c7d
commit 7431356913
5 changed files with 12 additions and 10 deletions

View File

@ -1,8 +1,8 @@
default currentDir = '${Directory.GetCurrentDirectory()}'
default nodeDir = '${Path.Combine(currentDir, "bin", "nodejs")}'
var bowerGloballyInstalled = '${TestCommand("bower", "--version")}'
var bowerInstalled = '${Directory.Exists(Path.Combine(nodeDir, "node_modules", "bower"))}'
var bowerGloballyInstalled = '${ !bowerInstalled && TestCommand("bower", "--version") }'
var bowerCmd = '${ bowerGloballyInstalled ? "bower" : Path.Combine(nodeDir, "node_modules", "bower", "bin", "bower") }'
- // Install bower locally if not already installed either globally or locally

View File

@ -1,8 +1,8 @@
default currentDir = '${Directory.GetCurrentDirectory()}'
default nodeDir = '${Path.Combine(currentDir, "bin", "nodejs")}'
var gruntCliGloballyInstalled = '${TestCommand("grunt", "--version")}'
var gruntCliInstalled = '${Directory.Exists(Path.Combine(nodeDir, "node_modules", "grunt-cli"))}'
var gruntCliGloballyInstalled = '${ !gruntCliInstalled && TestCommand("grunt", "--version") }'
var gruntCmd = '${ gruntCliGloballyInstalled ? "grunt" : Path.Combine(nodeDir, "node_modules", "grunt-cli") }'
-// Install grunt-cli locally

View File

@ -10,7 +10,7 @@ default nodeVer = '0.10.28'
default npmVer = '1.4.9'
default nodeExeSha = '628FFD6C3577068C00CEC9F6F897F0EC8F5212D9'
default nodeInstallDir = '${Path.Combine(binDir, "nodejs")}'
default nodeGloballyInstalled = '${TestCommand("node" , "--version")}'
default nodeGloballyInstalled = '${ !Directory.Exists(nodeInstallDir) && TestCommand("node" , "--version") }'
var nodeExe = 'node.exe'
var npmZip = 'npm-${npmVer}.zip'

View File

@ -1,8 +1,9 @@
default currentDir = '${Directory.GetCurrentDirectory()}'
default nodeDir = '${Path.Combine(currentDir, "bin", "node")}'
default nodeGloballyInstalled = '${TestCommand("node", "--version")}'
var nodeExePath = '${ nodeGloballyInstalled ? "node" : Path.Combine(nodeDir, "node.exe") }'
node-install once='installNode'
var nodeExeFile = '${ Path.Combine(nodeDir, "node.exe") }'
var nodeExePath = '${ File.Exists(nodeExeFile) ? nodeExeFile : "node" }'
exec program='${nodeExePath}' commandline='${nodeCommand}'

View File

@ -2,9 +2,10 @@ default currentDir = '${Directory.GetCurrentDirectory()}'
default nodeDir = '${Path.Combine(currentDir, "bin", "nodejs")}'
default npmDir = '${currentDir}'
var npmGloballyInstalled = '${TestCommand("npm" , "--version")}'
var npmCmd = '${ npmGloballyInstalled ? "npm" : Path.Combine(nodeDir, "npm.cmd") }'
node-install once='installNode'
var npmFile = '${ Path.Combine(nodeDir, "npm.cmd") }'
var npmCmd = '${ File.Exists(npmFile) ? npmFile : "npm" }'
exec program='cmd' commandline='/C ${npmCmd} ${npmCommand}' workingdir='${npmDir}' if='!IsLinux'
exec program='${npmCmd}' commandline='${npmCommand}' workingdir='${npmDir}' if='IsLinux'
exec program='${npmCmd}' commandline='${npmCommand}' workingdir='${npmDir}' if='IsLinux'