Example #1
0
        public override bool Execute(ExportInput input)
        {
            var runnerDirectory = Assembly.GetExecutingAssembly().Location.ParentDirectory();

            var bottling = Task.Factory.StartNew(() =>
            {
                if (!input.NoBottlingFlag)
                {
                    new BottleCommand().Execute(new BottleInput {
                        NoZipFlag = true
                    });
                }
            });

            var cleaning = Task.Factory.StartNew(() => cleanExplodedBottleContents(runnerDirectory));

            var hostCleaning = Task.Factory.StartNew(() => {
                if (input.HostFlag.IsNotEmpty())
                {
                    input.TryToCleanOutFubuContentFolder();
                }
            });

            Task.WaitAll(bottling, cleaning, hostCleaning);


            var directories = input.ToDirectories();

            try
            {
                _fileSystem.CreateDirectory(input.Output);
                if (input.CleanFlag)
                {
                    _fileSystem.CleanDirectory(input.Output);
                }

                var projects = input
                               .IncludeProjectsFlag
                               .Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries)
                               .Select(x => x.Trim());

                projects.Each(BottlesFilter.Include);

                FubuMode.Mode(string.Empty);
                var application = new FubuDocsExportingApplication(directories).BuildApplication();
                using (var server = application.RunEmbedded(directories.Solution))
                {
                    exportContent(input, server);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }

            return(true);
        }
Example #2
0
        private void cleanExplodedBottleContents(string runnerDirectory)
        {
            string explodedBottlesDirectory = runnerDirectory.AppendPath("fubu-content");

            Console.WriteLine("Trying to clean out the contents of " + explodedBottlesDirectory);
            fileSystem.CleanDirectory(explodedBottlesDirectory);
        }
Example #3
0
        public bool Initialize(InitializeInput input, IFileSystem fileSystem, ISimpleLogger logger)
        {
            var deploymentDirectory = input.Settings.DeploymentDirectory;

            logger.Log("Trying to initialize Bottles deployment folders at {0}", deploymentDirectory);

            if (fileSystem.DirectoryExists(deploymentDirectory))
            {
                if (input.ForceFlag)
                {
                    logger.Log(DELETING_EXISTING_DIRECTORY, deploymentDirectory);
                    fileSystem.CleanDirectory(deploymentDirectory);
                    fileSystem.DeleteDirectory(deploymentDirectory);
                    Thread.Sleep(10); //file system is async
                }
                else
                {
                    logger.Log(DIRECTORY_ALREADY_EXISTS, deploymentDirectory);
                    return(false);
                }
            }

            createDirectory(fileSystem, logger, deploymentDirectory);

            Console.WriteLine("Writing blank file to " + input.Settings.BottleManifestFile);
            fileSystem.WriteStringToFile(input.Settings.BottleManifestFile, "");

            createDirectory(fileSystem, logger, input.Settings.BottlesDirectory);
            createDirectory(fileSystem, logger, input.Settings.RecipesDirectory);
            createDirectory(fileSystem, logger, input.Settings.EnvironmentsDirectory);
            createDirectory(fileSystem, logger, input.Settings.ProfilesDirectory);

            return(true);
        }
Example #4
0
 /// <summary>
 /// Removes all package files and exploded package contents from an application
 /// </summary>
 /// <param name="applicationDirectory"></param>
 public void RemoveAllPackages(string applicationDirectory)
 {
     findPackageFolders(applicationDirectory).Each(dir =>
     {
         Console.WriteLine("Cleaning all the contents of directory " + dir);
         _fileSystem.CleanDirectory(dir);
     });
 }
Example #5
0
            public SolutionGraphScenarioDefinition()
            {
                _directory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid().ToString());

                _fileSystem.CleanDirectory(_directory);
                _fileSystem.DeleteDirectory(_directory);
                _fileSystem.DeleteDirectory(_directory);
                _fileSystem.CreateDirectory(_directory);

                _fileSystem.CreateDirectory(cacheDirectory);
            }
Example #6
0
 private void InitializeOutputDirectory(string outputDirectory)
 {
     if (!_fileSystem.DirectoryExists(outputDirectory))
     {
         _fileSystem.CreateDirectory(outputDirectory);
     }
     else
     {
         _fileSystem.CleanDirectory(outputDirectory);
     }
 }
Example #7
0
            public SolutionGraphScenarioDefinition()
            {
                _directory = Path.GetTempPath().AppendRandomPath();

                _fileSystem.CleanDirectory(_directory);
                _fileSystem.DeleteDirectory(_directory);
                _fileSystem.DeleteDirectory(_directory);
                _fileSystem.CreateDirectory(_directory);

                _fileSystem.CreateDirectory(cacheDirectory);
            }
Example #8
0
        public void Dispose()
        {
            theApplication.Fixtures.Dispose();

            try
            {
                _fileSystem.CleanDirectory(fixtureFolder);
                _fileSystem.DeleteDirectory(fixtureFolder);
            }
            catch (Exception)
            {
                // nothing
            }
        }
Example #9
0
        public void FindSamples()
        {
            if (!_fileSystem.DirectoryExists(_outputFolder))
            {
                Console.WriteLine("Creating folder " + _outputFolder);
                _fileSystem.CreateDirectory(_outputFolder);
            }
            else
            {
                Console.WriteLine("Cleaning out old samples at " + _outputFolder);
                _fileSystem.CleanDirectory(_outputFolder);
            }

            ReadDirectory(_codeFolder);
        }
Example #10
0
        public bool Execute(IFileSystem system, CreateAllInput input)
        {
            var settings = DeploymentSettings.ForDirectory(input.DeploymentFlag);

            ConsoleWriter.Write("Creating all packages");
            ConsoleWriter.Write("  Removing all previous package files");
            system.CleanDirectory(settings.BottlesDirectory);

            ConsoleWriter.Write("  Reading bottle manifest file at " + settings.BottleManifestFile);
            var bottleManifestFile = settings.BottleManifestFile;

            system.ReadTextFile(bottleManifestFile, dir => createPackage(dir, settings.BottlesDirectory, input));

            return(true);
        }
Example #11
0
        public void find_multiples_so_it_is_indeterminate()
        {
            fileSystem.CreateDirectory("multiples");
            fileSystem.CleanDirectory("multiples");
            fileSystem.WriteStringToFile("multiples".AppendPath("anything.sln"), "whatever");
            fileSystem.WriteStringToFile("multiples".AppendPath("else.sln"), "whatever");

            Environment.CurrentDirectory = Environment.CurrentDirectory.AppendPath("multiples").ToFullPath();


            SolutionFinder.FindSolutionFile().ShouldBeNull();

            // find the multiples too
            var solutions = SolutionFinder.FindSolutions();

            solutions.ShouldHaveTheSameElementsAs(
                "anything.sln", "else.sln");
        }