Exemplo n.º 1
0
        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! ");
        }
Exemplo n.º 2
0
        public static void AppSettings(this Maker maker, string environment)
        {
            var destination = A.Path(maker.Solution.AppDir, $"appSettings.{environment}.yml");

            if (File.Exists(destination))
            {
                Console2.GreyLine($"\tSkip\t{maker.Solution.Relative(destination)}");
                return;
            }

            var appSettingsExample = A.Path(maker.Solution.AppDir, $"appSettings-example.yml");

            // appSettings-example.yml exists, copy from it
            if (File.Exists(appSettingsExample))
            {
                Console2.GreyLine($"\tCopy\t{maker.Solution.Relative(appSettingsExample)}");
                Console2.GreyLine($"\tTo\t{maker.Solution.Relative(destination)}");

                File.Copy(appSettingsExample, destination);

                return;
            }

            // appSettings-example.yml does not exists, create from template
            maker.Template(
                "appSettings-example.yml",
                new { },
                destination);
        }
Exemplo n.º 3
0
        public override bool Execute(Input input)
        {
            Console2.BreakLine();

            _maker.Entity(input.Name);

            Console2.BreakLine();

            Console2.GreyLine("\tConsider adding to your DbContext:");
            Console2.BreakLine();
            Console2.WhiteLine($"\t\tpublic DbSet<{input.Name}> {input.Name.Pluralize()} {{ get; set; }}");

            return(true);
        }
Exemplo n.º 4
0
        public async Task Execute()
        {
            Console2.BreakLine();

            _maker.Entity(Name);

            Console2.BreakLine();

            Console2.GreyLine("\tConsider adding to your DbContext:");
            Console2.BreakLine();
            Console2.WhiteLine($"\t\tpublic DbSet<{Name}> {Name.Pluralize()} {{ get; set; }}");

            await Task.CompletedTask;
        }