Bari.Core.Process.MainProcess.Run C# (CSharp) Method

Run() public method

Runs the main bari process
public Run ( ) : bool
return bool
        public bool Run()
        {
            if (!parameters.QuietMode)
                output.Message("bari version {0}\n", Assembly.GetAssembly(typeof(MainProcess)).GetName().Version.ToString());

            var cmdPrereq = commandFactory.CreateCommandPrerequisites(parameters.Command);

            Suite suite;
            if (cmdPrereq == null || cmdPrereq.RequiresSuite)
            {
                suite = loader.Load(parameters.Suite);
                binding.Bind<Suite>().ToConstant(suite);

                explorer.RunAll(suite);
                suite.CheckForWarnings(output);
            }
            else
            {
                suite = new Suite(new LocalFileSystemDirectory(Path.GetTempPath()));
            }

            var cmd = commandFactory.CreateCommand(parameters.Command);
            if (cmd != null)
            {
                binding.Bind<ICommand>().ToConstant(cmd).WhenTargetHas<CurrentAttribute>();

                try
                {
                    return cmd.Run(suite, parameters.CommandParameters);
                }
                finally
                {
            #if DEBUG
                    if (!parameters.QuietMode)
                        builderStore.DumpStats(output);
            #endif
                }
            }
            else
            {
                throw new InvalidCommandException(parameters.Command, "Unknown command");
            }
        }