public void Execute() { Console2.BreakLine(); Console2.GreyLine($"Deleting folder {_newSolutionDir}"); Console2.BreakLine(); Directories.DeleteIfExists(_newSolutionDir); ExecuteShell($"miru new {SolutionName}", _workingDir); ExecuteShell("dotnet build --nologo", _newSolutionDir); ExecuteShell("miru assets:setup", _newSolutionDir); ExecuteShell("miru db:create", _newSolutionDir); ExecuteShell("miru db:create -e Test", _newSolutionDir); ExecuteShell("miru make:feature TopupNew Topups New", _newSolutionDir); ExecuteShell("miru make:entity Topup", _newSolutionDir); CopyFromSample(A.Path / "src" / SolutionName / "Database" / "Migrations" / "201911071845_CreateTopup.cs"); CopyFromSample(A.Path / "src" / SolutionName / "Database" / "MongDbContext.cs"); CopyFromSample(A.Path / "src" / SolutionName / "Features" / "Topups" / "New.cshtml"); CopyFromSample(A.Path / "src" / SolutionName / "Features" / "Topups" / "TopupNew.cs"); CopyFromSample(A.Path / "src" / SolutionName / "Domain" / "Topup.cs"); CopyFromSample(A.Path / "tests" / $"{SolutionName}.Tests" / "Features" / "Topups" / "TopupNewTest.cs"); CopyFromSample(A.Path / "tests" / $"{SolutionName}.PageTests" / "Pages" / "Topups" / "TopupNewPageTest.cs"); ExecuteShell("dotnet build --nologo", _newSolutionDir); ExecuteShell("miru test", _newSolutionDir); ExecuteShell("miru pagetest", _newSolutionDir); Console2.GreenLine("YES! "); }
public override async Task <bool> Execute(Input input) { Console2.Line("Seeding data"); _db.Categories.AddIfNotExists( m => m.Name == "Arts", new Category { Name = "Arts" }); _db.Categories.AddIfNotExists( m => m.Name == "Food", new Category { Name = "Food" }); _db.Categories.AddIfNotExists( m => m.Name == "Music", new Category { Name = "Music" }); await _db.SaveChangesAsync(); Console2.GreenLine("Done!"); return(true); }
public static void New(this Maker m, string name) { var newSolutionDir = A.Path(m.Solution.RootDir, name); ThrowIfNewDirectoryExist(newSolutionDir); Console.WriteLine(); // root m.Directory(); Console.WriteLine(); var map = Maker.ReadEmbedded("_New.yml").FromYml <Dictionary <string, string> >(); foreach (var(key, stub) in map) { // FIXME: Use same tokens replacement as m.Template var destination = key .Replace("Corpo.Skeleton", m.Solution.Name) .Replace("Skeleton", m.Solution.ShortName) .Replace('\\', Path.DirectorySeparatorChar); m.Template(stub, destination); } m.Template("appSettings-example.yml", A.Path("src") / name / "appSettings.Development.yml"); m.Template("appSettings-example.yml", A.Path("src") / name / "appSettings.Test.yml"); Console2.BreakLine(); Console2.Line($"New solution created at:"); Console2.BreakLine(); Console2.GreenLine($"\t{m.Solution.RootDir}"); Console2.BreakLine(); Console2.GreenLine("Good luck!"); }
public static void New(this Maker m, string name) { var newSolutionDir = A.Path(m.Solution.RootDir, name); ThrowIfNewDirectoryExist(newSolutionDir); Console.WriteLine(); // root m.Directory(); Console.WriteLine(); var map = Maker.ReadEmbedded("_New.yml").FromYml <Dictionary <string, string> >(); foreach (var(key, stub) in map) { var destination = key .Replace("Skeleton", name) .Replace('\\', Path.DirectorySeparatorChar); m.Template(stub, destination); } Console2.BreakLine(); Console2.Line($"New solution created at:"); Console2.BreakLine(); Console2.GreenLine($"\t{m.Solution.RootDir}"); Console2.BreakLine(); Console2.GreenLine("Good luck!"); }
public override async Task Execute() { Console2.Line("Creating database"); await _databaseCreator.Create(); Console2.GreenLine("Database created"); }
public Task Execute() { Console2.Line("Creating database"); _databaseCreator.Create().Wait(); Console2.GreenLine("Database created"); return(Task.CompletedTask); }
public override void Execute() { // TODO: rethink about /wwwroot/storage // TODO: create /wwwroot/storage dir if it does not exist var wwwrootStorage = _solution.AppDir / "wwwroot" / "storage"; var storageApp = _solution.RootDir / "storage" / "app"; Directories.CreateIfNotExists(storageApp); FileSystem.CreateSymbolicLink( storageApp, wwwrootStorage, FileType.Directory); Console2.GreenLine($"Created a symlink"); Console2.WhiteLine($"\tfrom: {storageApp}"); Console2.WhiteLine($"\tto: {wwwrootStorage}"); }
public Task Execute() { var wwwrootStorage = _solution.AppDir / "wwwroot" / "assets"; var storageApp = _solution.RootDir / "storage" / "assets"; Directories.CreateIfNotExists(storageApp); FileSystem.CreateSymbolicLink( storageApp, wwwrootStorage, FileType.Directory); Console2.GreenLine($"Created a symlink"); Console2.WhiteLine($"\tfrom: {storageApp}"); Console2.WhiteLine($"\tto: {wwwrootStorage}"); return(Task.CompletedTask); }
private void Execute() { var asm = new EmbeddedFiles <Program>(); var miruShellDestination = OS.IsWindows ? Path.Combine(OS.DotNetToolsPath, "miru.cmd") : Path.Combine(OS.DotNetToolsPath, "miru"); asm.ExtractFile(OS.IsWindows ? "miru.cmd" : "miru.sh", miruShellDestination); if (OS.IsWindows == false) { OS.ShellToConsole($"chmod +x {miruShellDestination}"); } Console.WriteLine(); Console2.GreenLine("Miru setup successfully. From now use the command anywhere: miru"); Console.WriteLine(); Console.WriteLine("Good luck!"); }
public override async Task Execute() { Console2.White("Seeding Users... "); _db.Users.AddIfNotExists(m => m.Name == "Admin", new User { Name = "Admin", Email = "*****@*****.**", HashedPassword = Hash.Create("admin"), IsAdmin = true, ConfirmedAt = DateTime.Now }); Console2.GreenLine("✅"); Console2.White($"Seeding Providers... "); _db.Providers.AddIfNotExists(m => m.Name == "Four", new Provider { Name = "Four", Amounts = "10,20,30,50" }); _db.Providers.AddIfNotExists(m => m.Name == "Lemon", new Provider { Name = "Lemon", Amounts = "15,25,50" }); _db.Providers.AddIfNotExists(m => m.Name == "G-Mobile", new Provider { Name = "G-Mobile", Amounts = "10,15,20,30" }); Console2.GreenLine("✅"); await _db.SaveChangesAsync(); }