Example #1
0
        public void ExplodeFiles(BottleExplosionRequest request)
        {
            var bottleName = request.BottleName;

            if (request.BottleDirectory.IsEmpty())
            {
                CopyTo(request.BottleName, request.DestinationDirectory);
                return;
            }

            var bottleFile = _settings.BottleFileFor(bottleName);
            _fileSystem.CreateDirectory(_settings.StagingDirectory);

            var tempDirectory = FileSystem.Combine(_settings.StagingDirectory, bottleName);

            explodeToStaging(request, bottleFile, tempDirectory);

            var sourceDirectory = FileSystem.Combine(tempDirectory, request.BottleDirectory);

            _fileSystem.CreateDirectory(request.DestinationDirectory);

            _fileSystem.FindFiles(sourceDirectory, new FileSet(){
                DeepSearch = true,
                Include = "*.*"
            }).Each(file =>
            {
                var destinationFile = FileSystem.Combine(request.DestinationDirectory, file.PathRelativeTo(sourceDirectory));
                request.Log.Trace("Copying {0} to {1}", file, destinationFile);

                _fileSystem.Copy(file, destinationFile);
            });
        }
Example #2
0
        public void ExplodeDeployerBottles(string destination)
        {
            _settings.DeployerBottleNames().Each(name =>
            {
                var request = new BottleExplosionRequest(){
                    BottleDirectory = BottleFiles.BinaryFolder,
                    BottleName = name,
                    DestinationDirectory = destination
                };

                _bottles.ExplodeFiles(request);
            });
        }
Example #3
0
        public void ExplodeFiles(BottleExplosionRequest request)
        {
            var bottleName = request.BottleName;

            if (request.BottleDirectory.IsEmpty())
            {
                CopyTo(request.BottleName, request.DestinationDirectory);
                return;
            }

            var bottleFile = _settings.BottleFileFor(bottleName);
            _fileSystem.CreateDirectory(_settings.StagingDirectory);

            var tempDirectory = _settings.StagingDirectory.AppendPath(bottleName);

            explodeToStaging(request, bottleFile, tempDirectory);

            var sourceDirectory = tempDirectory.AppendPath(request.BottleDirectory);

            _fileSystem.CreateDirectory(request.DestinationDirectory);

            var files = _fileSystem.FindFiles(sourceDirectory, new FileSet
                                                   {
                DeepSearch = true,
                Include = "*.*"
            });

            request.Log.Trace("Copying directory '{0}' to '{1}'", sourceDirectory, request.DestinationDirectory);
            files.Each(file =>
            {
                var destinationFile = request.DestinationDirectory.AppendPath(file.PathRelativeTo(sourceDirectory));
                if(request.DetailedLogging)
                {
                    request.Log.Trace("Copying {0} to {1}", file, destinationFile);
                }

                _fileSystem.Copy(file, destinationFile, request.CopyBehavior);
            });
        }
Example #4
0
        private void explodeToStaging(BottleExplosionRequest request, string bottleFile, string tempDirectory)
        {
            if (_bottlesExplodedToStaging.Contains(request.BottleName))
            {
                return;
            }

            request.Log.Trace("Exploding bottle {0} to {1}", bottleFile, tempDirectory);
            _zipService.ExtractTo(bottleFile, tempDirectory, ExplodeOptions.DeleteDestination);

            _bottlesExplodedToStaging.Add(request.BottleName);
        }
Example #5
0
 public bool Equals(BottleExplosionRequest other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.BottleName, BottleName) && Equals(other.BottleDirectory, BottleDirectory) && Equals(other.DestinationDirectory, DestinationDirectory);
 }