Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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!");
        }
Esempio n. 3
0
        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!");
        }
Esempio n. 4
0
        public override async Task Execute()
        {
            Console2.Line("Creating database");

            await _databaseCreator.Create();

            Console2.GreenLine("Database created");
        }
Esempio n. 5
0
        public override void Execute()
        {
            Console2.YellowLine("Host:");
            Console2.Line(_hostEnvironment.ToYml());

            Console2.YellowLine("Database:");
            Console2.Line(_dbOptions.ToYml());
        }
Esempio n. 6
0
            public Task Execute()
            {
                Console2.Line("Creating database");

                _databaseCreator.Create().Wait();

                Console2.GreenLine("Database created");

                return(Task.CompletedTask);
            }
Esempio n. 7
0
        public override bool Execute(Input input)
        {
            Console2.Yellow("App version: ");
            Console2.Line($"{Assembly.GetEntryAssembly().GetName().Name} {Assembly.GetEntryAssembly().GetName().Version}");

            Console2.Yellow("Miru version: ");
            Console2.Line(typeof(App).Assembly.GetName().Version?.ToString());
            Console.WriteLine();

            Console2.YellowLine("Host:");
            Console2.Line(_hostEnvironment.ToYml());

            Console2.YellowLine("All Configurations: ");
            Console.WriteLine(GetDebugView(_configuration as IConfigurationRoot));

            return(true);
        }