Updating commands for non windows machines
This commit is contained in:
parent
3edc04741c
commit
f61b1496b2
|
|
@ -9,5 +9,6 @@ var bowerCmd = '${ bowerGloballyInstalled ? "bower" : Path.Combine(nodeDir, "nod
|
||||||
npm npmCommand='install --prefix ${nodeDir} bower' if='!(bowerGloballyInstalled || bowerInstalled)' once='installBower'
|
npm npmCommand='install --prefix ${nodeDir} bower' if='!(bowerGloballyInstalled || bowerInstalled)' once='installBower'
|
||||||
|
|
||||||
- // Run bower
|
- // Run bower
|
||||||
exec program='cmd' commandline='/C ${bowerCmd} ${bowerCommand}' workingdir='${bowerDir}' if='bowerGloballyInstalled'
|
exec program='cmd' commandline='/C ${bowerCmd} ${bowerCommand}' workingdir='${bowerDir}' if='bowerGloballyInstalled && !IsLinux'
|
||||||
|
exec program='${bowerCmd}' commandline='${bowerCommand}' workingdir='${bowerDir}' if='bowerGloballyInstalled && IsLinux'
|
||||||
node nodeCommand='${bowerCmd} ${bowerCommand}' workingdir='${bowerDir}' if='!bowerGloballyInstalled'
|
node nodeCommand='${bowerCmd} ${bowerCommand}' workingdir='${bowerDir}' if='!bowerGloballyInstalled'
|
||||||
|
|
@ -131,7 +131,8 @@ default Configuration='${E("Configuration")}'
|
||||||
functions @{
|
functions @{
|
||||||
string E(string key) { return Environment.GetEnvironmentVariable(key); }
|
string E(string key) { return Environment.GetEnvironmentVariable(key); }
|
||||||
void E(string key, string value) { Environment.SetEnvironmentVariable(key, value); }
|
void E(string key, string value) { Environment.SetEnvironmentVariable(key, value); }
|
||||||
IEnumerable<string> GetDirectoriesContaining(string path, string searchPattern) {
|
IEnumerable<string> GetDirectoriesContaining(string path, string searchPattern)
|
||||||
|
{
|
||||||
var sep = Path.DirectorySeparatorChar;
|
var sep = Path.DirectorySeparatorChar;
|
||||||
// Don't include directories that are children of a node_modules or bower_components directory
|
// Don't include directories that are children of a node_modules or bower_components directory
|
||||||
return Directory.GetFiles(path, searchPattern, SearchOption.AllDirectories)
|
return Directory.GetFiles(path, searchPattern, SearchOption.AllDirectories)
|
||||||
|
|
@ -140,28 +141,45 @@ functions @{
|
||||||
.Select(p => Path.GetDirectoryName(p))
|
.Select(p => Path.GetDirectoryName(p))
|
||||||
.Distinct();
|
.Distinct();
|
||||||
}
|
}
|
||||||
bool TestCommand(string program, string commandline) {
|
bool TestCommand(string program, string commandline)
|
||||||
|
{
|
||||||
// Tests whether a given command succeeds at the command line.
|
// Tests whether a given command succeeds at the command line.
|
||||||
// Useful for testing whether a given command is installed and on the path, e.g. node
|
// Useful for testing whether a given command is installed and on the path, e.g. node
|
||||||
var processStartInfo = new ProcessStartInfo {
|
ProcessStartInfo processStartInfo;
|
||||||
UseShellExecute = false,
|
|
||||||
FileName = "cmd",
|
if(!IsLinux)
|
||||||
Arguments = "/C " + program + " " + commandline,
|
{
|
||||||
};
|
processStartInfo = new ProcessStartInfo {
|
||||||
try {
|
UseShellExecute = false,
|
||||||
|
FileName = "cmd",
|
||||||
|
Arguments = "/C " + program + " " + commandline,
|
||||||
|
};
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
processStartInfo = new ProcessStartInfo {
|
||||||
|
UseShellExecute = false,
|
||||||
|
FileName = program,
|
||||||
|
Arguments = commandline,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
Log.Info(string.Format("Testing for command: {0} {1}", program, commandline));
|
Log.Info(string.Format("Testing for command: {0} {1}", program, commandline));
|
||||||
var process = Process.Start(processStartInfo);
|
var process = Process.Start(processStartInfo);
|
||||||
process.WaitForExit();
|
process.WaitForExit();
|
||||||
if (process.ExitCode == 0) {
|
if (process.ExitCode == 0)
|
||||||
|
{
|
||||||
Log.Info(" command found (0 exit code)");
|
Log.Info(" command found (0 exit code)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
Log.Warn(" command not found (non-0 exit code)");
|
Log.Warn(" command not found (non-0 exit code)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex)
|
||||||
|
{
|
||||||
Log.Warn(" command exception: " + ex.ToString());
|
Log.Warn(" command exception: " + ex.ToString());
|
||||||
Log.Warn(" command not found");
|
Log.Warn(" command not found");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,5 @@ var npmGloballyInstalled = '${TestCommand("npm" , "--version")}'
|
||||||
var npmCmd = '${ npmGloballyInstalled ? "npm" : Path.Combine(nodeDir, "npm.cmd") }'
|
var npmCmd = '${ npmGloballyInstalled ? "npm" : Path.Combine(nodeDir, "npm.cmd") }'
|
||||||
|
|
||||||
node-install once='installNode'
|
node-install once='installNode'
|
||||||
exec program='cmd' commandline='/C ${npmCmd} ${npmCommand}' workingdir='${npmDir}'
|
exec program='cmd' commandline='/C ${npmCmd} ${npmCommand}' workingdir='${npmDir}' if='!IsLinux'
|
||||||
|
exec program='${npmCmd}' commandline='${npmCommand}' workingdir='${npmDir}' if='IsLinux'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue