diff --git a/build/_bower.shade b/build/_bower.shade index 3fc52cd796..f4e6562735 100644 --- a/build/_bower.shade +++ b/build/_bower.shade @@ -9,5 +9,6 @@ var bowerCmd = '${ bowerGloballyInstalled ? "bower" : Path.Combine(nodeDir, "nod npm npmCommand='install --prefix ${nodeDir} bower' if='!(bowerGloballyInstalled || bowerInstalled)' once='installBower' - // 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' \ No newline at end of file diff --git a/build/_k-standard-goals.shade b/build/_k-standard-goals.shade index 9922a58356..0ccb42df75 100644 --- a/build/_k-standard-goals.shade +++ b/build/_k-standard-goals.shade @@ -131,7 +131,8 @@ default Configuration='${E("Configuration")}' functions @{ string E(string key) { return Environment.GetEnvironmentVariable(key); } void E(string key, string value) { Environment.SetEnvironmentVariable(key, value); } - IEnumerable GetDirectoriesContaining(string path, string searchPattern) { + IEnumerable GetDirectoriesContaining(string path, string searchPattern) + { var sep = Path.DirectorySeparatorChar; // Don't include directories that are children of a node_modules or bower_components directory return Directory.GetFiles(path, searchPattern, SearchOption.AllDirectories) @@ -140,28 +141,45 @@ functions @{ .Select(p => Path.GetDirectoryName(p)) .Distinct(); } - bool TestCommand(string program, string commandline) { + bool TestCommand(string program, string commandline) + { // 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 - var processStartInfo = new ProcessStartInfo { - UseShellExecute = false, - FileName = "cmd", - Arguments = "/C " + program + " " + commandline, - }; - try { + ProcessStartInfo processStartInfo; + + if(!IsLinux) + { + processStartInfo = new ProcessStartInfo { + 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)); var process = Process.Start(processStartInfo); process.WaitForExit(); - if (process.ExitCode == 0) { + if (process.ExitCode == 0) + { Log.Info(" command found (0 exit code)"); return true; } - else { + else + { Log.Warn(" command not found (non-0 exit code)"); return false; } } - catch (Exception ex) { + catch (Exception ex) + { Log.Warn(" command exception: " + ex.ToString()); Log.Warn(" command not found"); return false; diff --git a/build/_npm.shade b/build/_npm.shade index 3b58d40ea3..df094054b5 100644 --- a/build/_npm.shade +++ b/build/_npm.shade @@ -6,4 +6,5 @@ var npmGloballyInstalled = '${TestCommand("npm" , "--version")}' var npmCmd = '${ npmGloballyInstalled ? "npm" : Path.Combine(nodeDir, "npm.cmd") }' node-install once='installNode' -exec program='cmd' commandline='/C ${npmCmd} ${npmCommand}' workingdir='${npmDir}' \ No newline at end of file +exec program='cmd' commandline='/C ${npmCmd} ${npmCommand}' workingdir='${npmDir}' if='!IsLinux' +exec program='${npmCmd}' commandline='${npmCommand}' workingdir='${npmDir}' if='IsLinux'