Esempio n. 1
0
        public bool Initialize(IDirectiveTypeRegistry registry, AddDirectiveInput input)
        {
            var directiveType = registry.DirectiveTypeFor(input.Directive);
            var directive     = directiveType.Create <IDirective>();

            var hostFile = input.GetHostFileName();

            _fileSystem.WriteToFlatFile(hostFile, file =>
            {
                var writer = new DirectiveWriter(file, new TypeDescriptorCache());
                writer.Write(directive);
            });

            if (input.OpenFlag)
            {
                _fileSystem.LaunchEditor(hostFile);
            }

            return(true);
        }
Esempio n. 2
0
        public override bool Execute(CreateDeploymentInput input)
        {
            var settings  = DeploymentSettings.ForDirectory(input.DeploymentFlag);
            var directive = new FubuWebsite();

            if (input.VirtualDirFlag.IsNotEmpty())
            {
                directive.VDir = input.VirtualDirFlag;
            }

            var fileSystem = new FileSystem();

            var hostFile = settings.GetHost(input.RecipeFlag, input.HostFlag);

            Console.WriteLine("Adding a new FubuWebsite directive to " + hostFile);

            fileSystem.WriteToFlatFile(hostFile, file =>
            {
                var writer = new DirectiveWriter(file, new TypeDescriptorCache());
                writer.Write(directive);
            });

            Console.WriteLine("");

            new AddReferenceCommand().Execute(new AddReferenceCommandInput()
            {
                Bottle = input.ApplicationBottleName,
                Host   = input.HostFlag,
                Recipe = input.RecipeFlag
            });

            if (input.OpenFlag)
            {
                fileSystem.LaunchEditor(hostFile);
            }

            return(true);
        }