Example #1
0
        public override bool Start()
        {
            #region Set EXE file path

            if (this.IsRubyInPath)
            {
                this.RubyPath = FindInPath.Find("ruby.exe", MainWindow.WorkingDirectory, false);
                this.SassPath = FindInPath.Find("sass", MainWindow.WorkingDirectory, true, true);
                if (SassPath.EndsWith(".bat", StringComparison.OrdinalIgnoreCase) || SassPath.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase) || SassPath.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase))
                {
                    HashSet <string> possibleSassLocations = FindPathInfo.InBat("\"ruby.exe\"", "sass\"", SassPath);
                    if (possibleSassLocations != null)
                    {
                        foreach (string possibleSassLocation in possibleSassLocations)
                        {
                            string temp = possibleSassLocation.Replace("\"", "").Replace("ruby.exe ", "");
                            if (File.Exists(temp))
                            {
                                SassPath = temp;
                                break;
                            }
                        }
                    }
                }
            }
            fileName  = RubyPath;
            arguments = "-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) \"" + PathConverter.ConvertWinToUnix(SassPath) + "\"";

            #endregion

            #region Merge paths

            InputPath = !String.IsNullOrEmpty(InputPath) ? PathConverter.ConvertUnixToWin(InputPath) : ".";
            if (Directory.Exists(InputPath))
            {
                if (InputPath[InputPath.Length - 1] != '\\')
                {
                    InputPath += '\\';
                }
            }
            if (Directory.Exists(OutputPath))
            {
                if (OutputPath[OutputPath.Length - 1] != '\\')
                {
                    OutputPath += '\\';
                }
            }
            if (String.IsNullOrEmpty(OutputPath))
            {
                workingDirectory = Path.GetDirectoryName(InputPath);
                InputPath        = PathConverter.ConvertWinToUnix(Path.GetFileName(InputPath));
                OutputPath       = PathConverter.ConvertWinToUnix(Path.GetFileName(OutputPath));
            }
            else
            {
                workingDirectory = ComparePath.Compare(InputPath, OutputPath, '\\');
                int headerIndex = workingDirectory.Length;
                InputPath  = PathConverter.ConvertWinToUnix(InputPath.Substring(headerIndex));
                OutputPath = PathConverter.ConvertWinToUnix(OutputPath.Substring(headerIndex));
            }
            if (String.IsNullOrEmpty(InputPath))
            {
                InputPath = ".";
            }
            if (String.IsNullOrEmpty(OutputPath))
            {
                OutputPath = ".";
            }

            #endregion

            #region Set arguments

            fileName   = this.RubyPath;
            arguments += " " + this.AddParams;
            if (!String.IsNullOrEmpty(CodeStyle))
            {
                arguments += " --style " + CodeStyle;
            }
            if (this.IsUseLF)
            {
                arguments += " --unix-newlines";
            }
            if (!this.IsWatch && this.IsForce)
            {
                arguments += " --force";
            }
            if (this.IsNoCache)
            {
                arguments += " --no-cache";
            }
            if (this.IsWatch)
            {
                arguments += " --watch " + this.InputPath + ":" + this.OutputPath;
            }
            else
            {
                arguments += " --update " + this.InputPath + ":" + this.OutputPath;
            }

            #endregion

            #region Set process properties

            setupInfo(fileName, arguments, workingDirectory);

            return(run());

            #endregion
        }
Example #2
0
        public override bool Start()
        {
            #region Set exe files path

            if (this.IsNodeInPath)
            {
                this.NodeJsPath = FindInPath.Find("node.exe", MainWindow.WorkingDirectory, false);
            }
            if (this.IsLesscGlobal)
            {
                LesscPath = FindInPath.Find("lessc", MainWindow.WorkingDirectory, true, false);
                if (LesscPath.EndsWith(".bat", StringComparison.OrdinalIgnoreCase) || LesscPath.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase) || LesscPath.EndsWith(".com", StringComparison.OrdinalIgnoreCase))
                {
                    HashSet <string> possibleLesscLocations = FindPathInfo.InBat("%~dp0\\.\\", "lessc", LesscPath);
                    if (possibleLesscLocations != null)
                    {
                        foreach (string possibleLesscLocation in possibleLesscLocations)
                        {
                            string temp         = possibleLesscLocation.Replace("%~dp0\\.\\", string.Empty);
                            string tempFullPath = Path.GetDirectoryName(LesscPath) + Path.DirectorySeparatorChar + temp;
                            if (File.Exists(tempFullPath))
                            {
                                LesscPath = tempFullPath;
                                break;
                            }
                        }
                    }
                }
                ;
            }
            fileName  = this.NodeJsPath;
            arguments = "\"" + PathConverter.ConvertWinToUnix(this.LesscPath) + "\"";

            #endregion

            #region Merge paths

            if (String.IsNullOrEmpty(this.InputPath))
            {
                return(false);
            }
            this.workingDirectory = Path.GetDirectoryName(this.InputPath);
            this.InputPath        = PathConverter.ConvertWinToUnix(InputPath.Substring(this.workingDirectory.Length + 1));
            if (String.IsNullOrEmpty(this.OutputPath))
            {
                this.OutputPath  = this.InputPath.Remove(this.InputPath.LastIndexOf('.'));
                this.OutputPath += ".css";
            }

            #endregion

            #region Set arguments

            arguments += " " + this.AddParams + " ";
            if (this.IsMinified)
            {
                arguments += "-x ";
            }
            arguments += this.InputPath;

            #endregion

            #region Set process properties

            setupInfo(fileName, arguments, workingDirectory);

            this.IsStdoutDisplayed = false;

            this.StdoutReceived -= this.handleStdoutReceived;
            this.StdoutReceived += this.handleStdoutReceived;

            this.ProcessExited -= this.handleProcessExited;
            this.ProcessExited += this.handleProcessExited;

            this.dataReceived = null;
            return(run());

            #endregion
        }
Example #3
0
        public override bool Start()
        {
            #region Set exe files path

            if (this.IsNodeInPath)
            {
                this.NodeJsPath = FindInPath.Find("node.exe", MainWindow.WorkingDirectory, false);
            }
            if (this.IsCoffeeGlobal)
            {
                CoffeePath = FindInPath.Find("coffee", MainWindow.WorkingDirectory, true, false);
                if (CoffeePath.EndsWith(".bat", StringComparison.OrdinalIgnoreCase) || CoffeePath.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase) || CoffeePath.EndsWith(".com", StringComparison.OrdinalIgnoreCase))
                {
                    HashSet <string> possibleCoffeeLocations = FindPathInfo.InBat("%~dp0\\.\\", "coffee", CoffeePath);
                    if (possibleCoffeeLocations != null)
                    {
                        foreach (string possibleCoffeeLocation in possibleCoffeeLocations)
                        {
                            string temp         = possibleCoffeeLocation.Replace("%~dp0\\.\\", string.Empty);
                            string tempFullPath = Path.GetDirectoryName(CoffeePath) + Path.DirectorySeparatorChar + temp;
                            if (File.Exists(tempFullPath))
                            {
                                CoffeePath = tempFullPath;
                                break;
                            }
                        }
                    }
                }
                ;
            }
            fileName  = this.NodeJsPath;
            arguments = "\"" + PathConverter.ConvertWinToUnix(this.CoffeePath) + "\"";

            #endregion

            #region Merge paths

            InputPath = !String.IsNullOrEmpty(InputPath) ? PathConverter.ConvertUnixToWin(InputPath) : ".";
            if (Directory.Exists(InputPath))
            {
                if (InputPath[InputPath.Length - 1] != '\\')
                {
                    InputPath += '\\';
                }
            }
            if (Directory.Exists(OutputPath))
            {
                if (OutputPath[OutputPath.Length - 1] != '\\')
                {
                    OutputPath += '\\';
                }
            }
            if (String.IsNullOrEmpty(OutputPath))
            {
                workingDirectory = Path.GetDirectoryName(InputPath);
                InputPath        = PathConverter.ConvertWinToUnix(Path.GetFileName(InputPath));
                OutputPath       = PathConverter.ConvertWinToUnix(Path.GetFileName(OutputPath));
            }
            else
            {
                workingDirectory = ComparePath.Compare(InputPath, OutputPath, '\\');
                int headerIndex = workingDirectory.Length;
                InputPath  = PathConverter.ConvertWinToUnix(InputPath.Substring(headerIndex));
                OutputPath = PathConverter.ConvertWinToUnix(OutputPath.Substring(headerIndex));
            }
            if (String.IsNullOrEmpty(InputPath))
            {
                InputPath = ".";
            }
            if (String.IsNullOrEmpty(OutputPath))
            {
                OutputPath = ".";
            }

            #endregion

            #region Set arguments

            arguments += " " + this.AddParams;
            if (this.IsBare)
            {
                arguments += " --bare";
            }
            if (this.IsWatch)
            {
                arguments += " --watch";
            }
            arguments += " --compile";
            if (!String.IsNullOrEmpty(OutputPath))
            {
                arguments += " --output " + this.OutputPath;
            }
            arguments += " " + this.InputPath;

            #endregion

            #region Set process properties

            setupInfo(fileName, arguments, workingDirectory);

            return(run());

            #endregion
        }