Inheritance: ICommandFactory
Esempio n. 1
0
        private static int Main(string[] args)
        {
            BottleFiles.ContentFolder = FubuMvcPackageFacility.FubuContentFolder;
            BottleFiles.PackagesFolder = FubuMvcPackageFacility.FubuPackagesFolder;

            try
            {
                var factory = new CommandFactory();
                factory.RegisterCommands(typeof(IFubuCommand).Assembly);
                factory.RegisterCommands(typeof(Program).Assembly);

                var executor = new CommandExecutor(factory);
                success = executor.Execute(args);
            }
            catch (CommandFailureException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: " + e.Message);
                Console.ResetColor();
                return 1;
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: " + ex);
                Console.ResetColor();
                return 1;
            }
            return success ? 0 : 1;
        }
Esempio n. 2
0
        public static int Main(string[] args)
        {
            BottleFiles.ContentFolder = FubuMvcPackageFacility.FubuContentFolder;
            BottleFiles.PackagesFolder = FileSystem.Combine("bin", FubuMvcPackageFacility.FubuPackagesFolder);

            try
            {
                var factory = new CommandFactory();
                factory.RegisterCommands(typeof(AliasCommand).Assembly);
                factory.RegisterCommands(typeof(IFubuCommand).Assembly);
                factory.RegisterCommands(typeof(Program).Assembly);

                // TODO -- don't think this should be permanent
                factory.RegisterCommands(typeof(CreateVdirCommand).Assembly);

                var executor = new CommandExecutor(factory);
                success = executor.Execute(args);
            }
            catch (CommandFailureException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: " + e.Message);
                Console.ResetColor();
                return 1;
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: " + ex);
                Console.ResetColor();
                return 1;
            }
            return success ? 0 : 1;
        }
Esempio n. 3
0
        public void Execute(string command)
        {
            var factory = new CommandFactory();
            factory.RegisterCommands(typeof (NewCommand).Assembly);

            factory.BuildRun(command).Execute();
        }
Esempio n. 4
0
        private static int Main(string[] args)
        {
            try
            {
                var factory = new CommandFactory();
                factory.SetAppName("bottles");
                factory.RegisterCommands(typeof(IFubuCommand).Assembly);
                factory.RegisterCommands(typeof(BottleExploder).Assembly);

                var executor = new CommandExecutor(factory);
                success = executor.Execute(args);
            }
            catch (CommandFailureException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                ConsoleWriter.Write("ERROR: " + e.Message);
                Console.ResetColor();
                return 1;
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                ConsoleWriter.Write("ERROR: " + ex);
                Console.ResetColor();
                return 1;
            }
            return success ? 0 : 1;
        }
Esempio n. 5
0
 private static ICommandFactory Bootstrap()
 {
     var commands = new CommandFactory();
     commands.RegisterCommands(typeof(IFubuCommand).Assembly);
     commands.RegisterCommands(Assembly.GetExecutingAssembly());
     return commands;
 }
Esempio n. 6
0
        public static int Main(string[] args)
        {
            try
            {
                var factory = new CommandFactory();
                factory.RegisterCommands(typeof(IFubuCommand).Assembly);
                factory.RegisterCommands(typeof(FolderInput).Assembly);

                var executor = new CommandExecutor(factory);
                success = executor.Execute(args);
            }
            catch (CommandFailureException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: " + e.Message);
                Console.ResetColor();
                return 1;
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: " + ex);
                Console.ResetColor();
                return 1;
            }
            return success ? 0 : 1;
        }
Esempio n. 7
0
        private static int Main(string[] args)
        {
            try
            {
                var factory = new CommandFactory();
                factory.RegisterCommands(typeof (Program).Assembly);

                var executor = new CommandExecutor(factory);
                success = executor.Execute(args);
            }
            catch (CommandFailureException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: " + e.Message);
                Console.ResetColor();
                return 1;
            }
            catch (RippleFatalError)
            {
                return 1;
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: " + ex);
                Console.ResetColor();
                return 1;
            }

            return success ? 0 : 1;
        }
Esempio n. 8
0
        public static int Main(string[] args)
        {
            try
            {
                var factory = new CommandFactory();
                factory.RegisterCommands(typeof (IFubuCommand).Assembly);
                factory.RegisterCommands(typeof (Program).Assembly);

                // TODO -- don't think this should be permanent
                factory.RegisterCommands(typeof (StringToken).Assembly);

                var executor = new CommandExecutor(factory);
                success = executor.Execute(args);
            }
            catch (CommandFailureException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: " + e.Message);
                Console.ResetColor();
                return 1;
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: " + ex);
                Console.ResetColor();
                return 1;
            }
            return success ? 0 : 1;
        }
Esempio n. 9
0
        public static int Main(string[] args)
        {
            // Try to magically determine the FubuMvcPackage folder here

            try
            {
                var factory = new CommandFactory();
                factory.RegisterCommands(typeof(Program).Assembly);

                var executor = new CommandExecutor(factory);
                success = executor.Execute(args);
            }
            catch (CommandFailureException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: " + e.Message);
                Console.ResetColor();
                return 1;
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: " + ex);
                Console.ResetColor();
                return 1;
            }

            return success ? 0 : 1;
        }
Esempio n. 10
0
        private static void Main(string[] args)
        {
            var factory = new CommandFactory();
            factory.RegisterCommands(typeof (IFubuCommand).Assembly);
            factory.RegisterCommands(typeof (Program).Assembly);

            var executor = new CommandExecutor(factory);
            executor.Execute(args);
        }
Esempio n. 11
0
        public void try_to_create_a_package()
        {
            var factory = new CommandFactory();
            factory.RegisterCommands(typeof(IFubuCommand).Assembly);
            factory.RegisterCommands(typeof(CreatePackageCommand).Assembly);

            var atRoot = false;
            var directory = Environment.CurrentDirectory;
            while(!atRoot)
            {
                directory = new DirectoryInfo(directory).Parent.FullName;
                atRoot = Directory.Exists(Path.Combine(directory, "src"));
            }

            Environment.CurrentDirectory = directory;

            var executor = new CommandExecutor(factory);
            executor.Execute("init-pak src/TestPackage4 pak4");
            executor.Execute("create-pak pak4 pak4.zip -f");
        }
Esempio n. 12
0
        private static int Main(string[] args)
        {
            try
            {
                var factory = new CommandFactory();
                factory.RegisterCommands(typeof (IFubuCommand).Assembly);
                factory.RegisterCommands(typeof (Program).Assembly);

                var executor = new CommandExecutor(factory);
                executor.Execute(args);
            }
            catch(Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: " + ex);
                Console.ResetColor();
                return 1;
            }
            return 0;
        }
        public void all_commands_usage_graph_works()
        {
            var factory = new CommandFactory();
            factory.RegisterCommands(typeof(AliasCommand).Assembly);
            factory.RegisterCommands(typeof(IFubuCommand).Assembly);

            factory.AllCommandTypes().Each(t =>
            {

                try
                {
                    var usageGraph = new UsageGraph(t);
                    usageGraph.WriteUsages();

                    Assert.IsTrue(usageGraph.Usages.Any(), "Found usages for " + t.FullName);
                }
                catch (Exception e)
                {
                    throw new ApplicationException("Command type:  " + t.FullName, e);
                }
            });
        }
Esempio n. 14
0
 protected static ICommandFactory Bootstrap(Assembly assembly)
 {
     var commandFactory = new CommandFactory();
     commandFactory.RegisterCommands(assembly);
     return commandFactory;
 }