Ejemplo n.º 1
0
        private IPreparedUpdate PrepareUpdate(AppUpdater updater, IExtendedFileSystem fileSystem, IPackage package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            if (package.Version < updater.CurrentVersion)
            {
                throw new BackwardUpdateException(updater.CurrentVersion, package.Version);
            }

            var prepDirectory = Path.Combine(fileSystem.AppDirectory, ".updates", package.Version.ToString());
            var preparedFiles = new List <string>();

            foreach (var packageFile in package.GetFiles("tools"))
            {
                var targetPath = Path.Combine(prepDirectory, Get(packageFile.Path, relativeTo: "app"));
                fileSystem.AddFile(targetPath, packageFile.GetStream());

                preparedFiles.Add(targetPath);
            }

            return(new PreparedUpdate(package.Version, preparedFiles));
        }
Ejemplo n.º 2
0
 public NuGet(
     IExtendedFileSystem fileSystem,
     IPackageBuilderFactory packageBuilderFactory)
 {
     _fileSystem            = fileSystem ?? new FileSystemWrapper();
     _packageBuilderFactory = packageBuilderFactory ?? new PackageBuilderFactory();
 }
Ejemplo n.º 3
0
 public NuGet(
     IExtendedFileSystem fileSystem,
     IPackageBuilderFactory packageBuilderFactory)
 {
     _fileSystem = fileSystem ?? new FileSystemWrapper();
     _packageBuilderFactory = packageBuilderFactory ?? new PackageBuilderFactory();
 }
Ejemplo n.º 4
0
        public AppUpdater(NuGetConfig nugetConfig, IAppVersionProvider appVersionProvider, IExtendedFileSystem fileSystem, ICommandLineWrapper commandLineWrapper, IProcessWrapper processWrapper)
        {
            _appVersionProvider = appVersionProvider;
            _fileSystem = fileSystem;
            _commandLineWrapper = commandLineWrapper;
            _processWrapper = processWrapper;
            _packageSource = nugetConfig.PackageSource;
            _appPackageId = nugetConfig.AppPackageId;
            _packageRepositoryFactory = nugetConfig.RepositoryFactory;

            _oldVersionDir = Path.Combine(_fileSystem.AppDirectory, ".old");
        }
Ejemplo n.º 5
0
        public AppUpdater(NuGetConfig nugetConfig, IAppVersionProvider appVersionProvider, IExtendedFileSystem fileSystem, ICommandLineWrapper commandLineWrapper, IProcessWrapper processWrapper)
        {
            _appVersionProvider       = appVersionProvider;
            _fileSystem               = fileSystem;
            _commandLineWrapper       = commandLineWrapper;
            _processWrapper           = processWrapper;
            _packageSource            = nugetConfig.PackageSource;
            _appPackageId             = nugetConfig.AppPackageId;
            _packageRepositoryFactory = nugetConfig.RepositoryFactory;

            _oldVersionDir = Path.Combine(_fileSystem.AppDirectory, ".old");
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Control how the <see cref="AppUpdater"/> will access the file system.
 /// </summary>
 public AppUpdaterBuilder FileSystemAccessedThrough(IExtendedFileSystem fileSystem)
 {
     _fileSystem = fileSystem;
     return this;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Control how the <see cref="AppUpdater"/> will access the file system.
 /// </summary>
 public AppUpdaterBuilder FileSystemAccessedThrough(IExtendedFileSystem fileSystem)
 {
     _fileSystem = fileSystem;
     return(this);
 }
Ejemplo n.º 8
0
        private IPreparedUpdate PrepareUpdate(AppUpdater updater, IExtendedFileSystem fileSystem, IPackage package)
        {
            if (package == null)
                throw new ArgumentNullException("package");

            if (package.Version < updater.CurrentVersion)
                throw new BackwardUpdateException(updater.CurrentVersion, package.Version);

            var prepDirectory = Path.Combine(fileSystem.AppDirectory, ".updates", package.Version.ToString());
            var preparedFiles = new List<string>();

            foreach (var packageFile in package.GetFiles("tools"))
            {
                var targetPath = Path.Combine(prepDirectory, Get(packageFile.Path, relativeTo: "app"));
                fileSystem.AddFile(targetPath, packageFile.GetStream());

                preparedFiles.Add(targetPath);
            }

            return new PreparedUpdate(package.Version, preparedFiles);
        }