Beispiel #1
0
        public void CreateProject(string name, string gitUrl, IPushMessage output,
                                  IReceiveStreamWriter input)
        {
            if (Exists(name))
            {
                output.PushMessage($"Project {name} already exists.");

                return;
            }


            string configPath = GetConfigPath(name);
            string projPath   = GetProjectPath(name);

            var proj = new Project()
            {
                GitUrl = gitUrl,
            };

            SaveProject(name, proj);

            Directory.CreateDirectory(projPath);


            // Clone git repo
            Shell.WorkingDirectory = projPath;
            var process = Shell.Execute("git", $"clone \"{gitUrl}\" .",
                                        output.PushMessage);

            input.SetStreamWriter(process.StandardInput);

            process.WaitForExit();
            process.Close();
        }
Beispiel #2
0
        public void RunProject(string name, string args, IPushMessage output,
                               IReceiveStreamWriter input)
        {
            if (Exists(name))
            {
                var proj = LoadProject(name);


                SyncProject(name, output);


                // Run script
                if (string.IsNullOrWhiteSpace(proj.RunScript) == false)
                {
                    Shell.WorkingDirectory = GetProjectPath(name);
                    var process = Shell.Execute("cmd", "/C " + proj.RunScript + " " + args,
                                                output.PushMessage);

                    input.SetStreamWriter(process.StandardInput);

                    process.WaitForExit();
                    process.Close();
                }
            }
            else
            {
                output.PushMessage($"Project {name} does not exists.");
            }
        }
Beispiel #3
0
        public void CmdProject(string name, string command, IPushMessage output,
                               IReceiveStreamWriter input)
        {
            if (Exists(name))
            {
                Shell.WorkingDirectory = GetProjectPath(name);
                var process = Shell.Execute("cmd", "/C " + command,
                                            output.PushMessage);

                input.SetStreamWriter(process.StandardInput);

                process.WaitForExit();
                process.Close();
            }
            else
            {
                output.PushMessage($"Project {name} does not exists.");
            }
        }