Exemplo n.º 1
0
        /// <summary>
        /// Runs the main bari process
        /// </summary>
        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");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Runs the main bari process
        /// </summary>
        public bool Run()
        {
            output.Message("bari version {0}\n", Assembly.GetAssembly(typeof(MainProcess)).GetName().Version.ToString());

            var suite = loader.Load(parameters.Suite);

            binding.Bind <Suite>().ToConstant(suite);

            explorer.RunAll(suite);
            suite.CheckForWarnings(output);

            var cmd = commandFactory.CreateCommand(parameters.Command);

            if (cmd != null)
            {
                binding.Bind <ICommand>().ToConstant(cmd).WhenTargetHas <CurrentAttribute>();
                return(cmd.Run(suite, parameters.CommandParameters));
            }
            else
            {
                throw new InvalidCommandException(parameters.Command, "Unknown command");
            }
        }