示例#1
0
文件: Program.cs 项目: Memmo/fubumvc
        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;
        }
示例#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;
        }
示例#3
0
文件: Program.cs 项目: ventaur/ripple
        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;
        }
示例#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;
        }
示例#5
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;
        }
示例#6
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;
        }
示例#7
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;
        }
 protected static void DefaultExecution(string[] args)
 {
     var commands = Bootstrap(Assembly.GetCallingAssembly());
     var executor = new CommandExecutor(commands);
     if (args.Length > 0)
         executor.Execute(args);
     else
         executor.Execute("help");
 }
        public void SetUp()
        {
            factory = MockRepository.GenerateMock<ICommandFactory>();
            command = MockRepository.GenerateMock<IFubuCommand>();
            theInput = new object();
            commandLine = "some stuff here";

            theExecutor = new CommandExecutor(factory);
        }
示例#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);
        }
示例#11
0
        static void Main(string[] args)
        {
            ConsoleApp.MoveWindow(25, 25);

            var commands = Bootstrap();
            var executor = new CommandExecutor(commands);
            var command = Help(executor);

            while (command != "exit")
            {
                executor.Execute(command);
                command = Help(executor);
            }
        }
示例#12
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");
        }
示例#13
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;
        }
示例#14
0
 private static string Help(CommandExecutor executor)
 {
     executor.Execute("help");
     var command = Console.ReadLine();
     return command;
 }