Example #1
0
        public string GetLatestVersion(bool ignorePrerelease)
        {
            try
            {
                return(EffectiveStrategy.GetLatestVersion(ignorePrerelease));
            }
            catch (WebException)
            {
                if (FallbackStrategy == null)
                {
                    var latestVersion = GetLatestVersionInCache(ignorePrerelease);

                    ConsoleImpl.WriteDebug("Unable to look up the latest version online, the cache contains version {0}.", latestVersion);

                    return(latestVersion);
                }
                throw;
            }
        }
Example #2
0
        public void DownloadVersion(string latestVersion, string target)
        {
            var cached = Path.Combine(_paketCacheDir, latestVersion, "paket.exe");

            if (!FileProxy.Exists(cached))
            {
                ConsoleImpl.WriteDebug("Version {0} not found in cache.", latestVersion);

                EffectiveStrategy.DownloadVersion(latestVersion, target);
                DirectoryProxy.CreateDirectory(Path.GetDirectoryName(cached));
                FileProxy.Copy(target, cached);
            }
            else
            {
                ConsoleImpl.WriteDebug("Copying version {0} from cache.", latestVersion);

                FileProxy.Copy(cached, target, true);
            }
        }
Example #3
0
        protected override void DownloadVersionCore(string latestVersion, string target)
        {
            var cached = Path.Combine(_paketCacheDir, latestVersion, "paket.exe");

            if (!FileSystemProxy.FileExists(cached))
            {
                ConsoleImpl.WriteInfo("Version {0} not found in cache.", latestVersion);

                EffectiveStrategy.DownloadVersion(latestVersion, target);

                ConsoleImpl.WriteTrace("Caching version {0} for later", latestVersion);
                FileSystemProxy.CreateDirectory(Path.GetDirectoryName(cached));
                FileSystemProxy.CopyFile(target, cached);
            }
            else
            {
                ConsoleImpl.WriteInfo("Copying version {0} from cache.", latestVersion);
                ConsoleImpl.WriteTrace("{0} -> {1}", cached, target);
                FileSystemProxy.CopyFile(cached, target, true);
            }
        }
 protected override void SelfUpdateCore(string latestVersion)
 {
     EffectiveStrategy.SelfUpdate(latestVersion);
 }
 public void SelfUpdate(string latestVersion)
 {
     EffectiveStrategy.SelfUpdate(latestVersion);
 }