public static async Task RemoveProject(string companyName, MicroServiceEntity entity) { var path = await GoFilePaths.GetProjectPath(companyName, entity.Name); if (Directory.Exists(path)) { DeleteHelper.DeleteDirectory(path); } }
public static async Task Generate(string companyName, MicroServiceEntity entity) { var newProjectDir = await GoFilePaths.GetProjectPath(companyName, entity.Name); if (!Directory.Exists(newProjectDir)) { Directory.CreateDirectory(newProjectDir); } await GoFileGenerator.GenerateHealthcheckFile(newProjectDir, "healthCheck"); await GoFileGenerator.GenerateMainFile(newProjectDir, "localhost", "3000"); }
public static async Task Start(string companyName, MicroServiceEntity entity) { var projectName = Constants.appNamePrefix + entity.Name.Kebaberize(); var projectPath = await GoFilePaths.GetProjectPath(companyName, entity.Name); await GoCommands.Build(projectPath); var buildPath = Path.Combine(projectPath, projectName + ".exe"); var port = MachinePorts.GetAvailablePort(3000); var runLocation = $"localhost:{port}"; Console.WriteLine($"Attempting to run {entity.Name} at {runLocation}"); using (var cli = new Cli(buildPath)) { cli.ExecuteAndForget(runLocation); Console.WriteLine($"{entity.Name} running at {runLocation}"); } }