mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
@@ -53,12 +53,9 @@ namespace Squirrel
|
|||||||
/// <returns>List with the elements that share the same maximum key value.</returns>
|
/// <returns>List with the elements that share the same maximum key value.</returns>
|
||||||
public static IList<TSource> MaxBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
|
public static IList<TSource> MaxBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
|
||||||
{
|
{
|
||||||
if (source == null)
|
if (source == null) throw new ArgumentNullException("source");
|
||||||
throw new ArgumentNullException("source");
|
if (keySelector == null) throw new ArgumentNullException("keySelector");
|
||||||
if (keySelector == null)
|
if (comparer == null) throw new ArgumentNullException("comparer");
|
||||||
throw new ArgumentNullException("keySelector");
|
|
||||||
if (comparer == null)
|
|
||||||
throw new ArgumentNullException("comparer");
|
|
||||||
|
|
||||||
return ExtremaBy(source, keySelector, (key, minValue) => comparer.Compare(key, minValue));
|
return ExtremaBy(source, keySelector, (key, minValue) => comparer.Compare(key, minValue));
|
||||||
}
|
}
|
||||||
@@ -67,27 +64,21 @@ namespace Squirrel
|
|||||||
{
|
{
|
||||||
var result = new List<TSource>();
|
var result = new List<TSource>();
|
||||||
|
|
||||||
using (var e = source.GetEnumerator())
|
using (var e = source.GetEnumerator()) {
|
||||||
{
|
if (!e.MoveNext()) throw new InvalidOperationException("Source sequence doesn't contain any elements.");
|
||||||
if (!e.MoveNext())
|
|
||||||
throw new InvalidOperationException("Source sequence doesn't contain any elements.");
|
|
||||||
|
|
||||||
var current = e.Current;
|
var current = e.Current;
|
||||||
var resKey = keySelector(current);
|
var resKey = keySelector(current);
|
||||||
result.Add(current);
|
result.Add(current);
|
||||||
|
|
||||||
while (e.MoveNext())
|
while (e.MoveNext()) {
|
||||||
{
|
|
||||||
var cur = e.Current;
|
var cur = e.Current;
|
||||||
var key = keySelector(cur);
|
var key = keySelector(cur);
|
||||||
|
|
||||||
var cmp = compare(key, resKey);
|
var cmp = compare(key, resKey);
|
||||||
if (cmp == 0)
|
if (cmp == 0) {
|
||||||
{
|
|
||||||
result.Add(cur);
|
result.Add(cur);
|
||||||
}
|
} else if (cmp > 0) {
|
||||||
else if (cmp > 0)
|
|
||||||
{
|
|
||||||
result = new List<TSource> { cur };
|
result = new List<TSource> { cur };
|
||||||
resKey = key;
|
resKey = key;
|
||||||
}
|
}
|
||||||
@@ -106,10 +97,8 @@ namespace Squirrel
|
|||||||
/// <returns>Sequence exhibiting the specified side-effects upon enumeration.</returns>
|
/// <returns>Sequence exhibiting the specified side-effects upon enumeration.</returns>
|
||||||
public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext)
|
public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext)
|
||||||
{
|
{
|
||||||
if (source == null)
|
if (source == null) throw new ArgumentNullException("source");
|
||||||
throw new ArgumentNullException("source");
|
if (onNext == null) throw new ArgumentNullException("onNext");
|
||||||
if (onNext == null)
|
|
||||||
throw new ArgumentNullException("onNext");
|
|
||||||
|
|
||||||
return DoHelper(source, onNext, _ => { }, () => { });
|
return DoHelper(source, onNext, _ => { }, () => { });
|
||||||
}
|
}
|
||||||
@@ -124,12 +113,9 @@ namespace Squirrel
|
|||||||
/// <returns>Sequence exhibiting the specified side-effects upon enumeration.</returns>
|
/// <returns>Sequence exhibiting the specified side-effects upon enumeration.</returns>
|
||||||
public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext, Action onCompleted)
|
public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext, Action onCompleted)
|
||||||
{
|
{
|
||||||
if (source == null)
|
if (source == null) throw new ArgumentNullException("source");
|
||||||
throw new ArgumentNullException("source");
|
if (onNext == null) throw new ArgumentNullException("onNext");
|
||||||
if (onNext == null)
|
if (onCompleted == null) throw new ArgumentNullException("onCompleted");
|
||||||
throw new ArgumentNullException("onNext");
|
|
||||||
if (onCompleted == null)
|
|
||||||
throw new ArgumentNullException("onCompleted");
|
|
||||||
|
|
||||||
return DoHelper(source, onNext, _ => { }, onCompleted);
|
return DoHelper(source, onNext, _ => { }, onCompleted);
|
||||||
}
|
}
|
||||||
@@ -144,12 +130,9 @@ namespace Squirrel
|
|||||||
/// <returns>Sequence exhibiting the specified side-effects upon enumeration.</returns>
|
/// <returns>Sequence exhibiting the specified side-effects upon enumeration.</returns>
|
||||||
public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError)
|
public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError)
|
||||||
{
|
{
|
||||||
if (source == null)
|
if (source == null) throw new ArgumentNullException("source");
|
||||||
throw new ArgumentNullException("source");
|
if (onNext == null) throw new ArgumentNullException("onNext");
|
||||||
if (onNext == null)
|
if (onError == null) throw new ArgumentNullException("onError");
|
||||||
throw new ArgumentNullException("onNext");
|
|
||||||
if (onError == null)
|
|
||||||
throw new ArgumentNullException("onError");
|
|
||||||
|
|
||||||
return DoHelper(source, onNext, onError, () => { });
|
return DoHelper(source, onNext, onError, () => { });
|
||||||
}
|
}
|
||||||
@@ -165,34 +148,25 @@ namespace Squirrel
|
|||||||
/// <returns>Sequence exhibiting the specified side-effects upon enumeration.</returns>
|
/// <returns>Sequence exhibiting the specified side-effects upon enumeration.</returns>
|
||||||
public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)
|
public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)
|
||||||
{
|
{
|
||||||
if (source == null)
|
if (source == null) throw new ArgumentNullException("source");
|
||||||
throw new ArgumentNullException("source");
|
if (onNext == null) throw new ArgumentNullException("onNext");
|
||||||
if (onNext == null)
|
if (onError == null) throw new ArgumentNullException("onError");
|
||||||
throw new ArgumentNullException("onNext");
|
if (onCompleted == null) throw new ArgumentNullException("onCompleted");
|
||||||
if (onError == null)
|
|
||||||
throw new ArgumentNullException("onError");
|
|
||||||
if (onCompleted == null)
|
|
||||||
throw new ArgumentNullException("onCompleted");
|
|
||||||
|
|
||||||
return DoHelper(source, onNext, onError, onCompleted);
|
return DoHelper(source, onNext, onError, onCompleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<TSource> DoHelper<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)
|
private static IEnumerable<TSource> DoHelper<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)
|
||||||
{
|
{
|
||||||
using (var e = source.GetEnumerator())
|
using (var e = source.GetEnumerator()) {
|
||||||
{
|
while (true) {
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
var current = default(TSource);
|
var current = default(TSource);
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
if (!e.MoveNext())
|
if (!e.MoveNext())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
current = e.Current;
|
current = e.Current;
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
onError(ex);
|
onError(ex);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
@@ -214,19 +188,16 @@ namespace Squirrel
|
|||||||
/// <returns>Sequence starting with the specified prefix value, followed by the source sequence.</returns>
|
/// <returns>Sequence starting with the specified prefix value, followed by the source sequence.</returns>
|
||||||
public static IEnumerable<TSource> StartWith<TSource>(this IEnumerable<TSource> source, params TSource[] values)
|
public static IEnumerable<TSource> StartWith<TSource>(this IEnumerable<TSource> source, params TSource[] values)
|
||||||
{
|
{
|
||||||
if (source == null)
|
if (source == null) throw new ArgumentNullException("source");
|
||||||
throw new ArgumentNullException("source");
|
|
||||||
|
|
||||||
return source.StartWith_(values);
|
return source.StartWith_(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
static IEnumerable<TSource> StartWith_<TSource>(this IEnumerable<TSource> source, params TSource[] values)
|
static IEnumerable<TSource> StartWith_<TSource>(this IEnumerable<TSource> source, params TSource[] values)
|
||||||
{
|
{
|
||||||
foreach (var x in values)
|
foreach (var x in values) yield return x;
|
||||||
yield return x;
|
|
||||||
|
|
||||||
foreach (var item in source)
|
foreach (var item in source) yield return item;
|
||||||
yield return item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -239,10 +210,8 @@ namespace Squirrel
|
|||||||
/// <returns>Sequence that contains the elements from the source sequence with distinct key values.</returns>
|
/// <returns>Sequence that contains the elements from the source sequence with distinct key values.</returns>
|
||||||
public static IEnumerable<TSource> Distinct<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
public static IEnumerable<TSource> Distinct<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
||||||
{
|
{
|
||||||
if (source == null)
|
if (source == null) throw new ArgumentNullException("source");
|
||||||
throw new ArgumentNullException("source");
|
if (keySelector == null) throw new ArgumentNullException("keySelector");
|
||||||
if (keySelector == null)
|
|
||||||
throw new ArgumentNullException("keySelector");
|
|
||||||
|
|
||||||
return source.Distinct_(keySelector, EqualityComparer<TKey>.Default);
|
return source.Distinct_(keySelector, EqualityComparer<TKey>.Default);
|
||||||
}
|
}
|
||||||
@@ -258,12 +227,9 @@ namespace Squirrel
|
|||||||
/// <returns>Sequence that contains the elements from the source sequence with distinct key values.</returns>
|
/// <returns>Sequence that contains the elements from the source sequence with distinct key values.</returns>
|
||||||
public static IEnumerable<TSource> Distinct<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
|
public static IEnumerable<TSource> Distinct<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
|
||||||
{
|
{
|
||||||
if (source == null)
|
if (source == null) throw new ArgumentNullException("source");
|
||||||
throw new ArgumentNullException("source");
|
if (keySelector == null) throw new ArgumentNullException("keySelector");
|
||||||
if (keySelector == null)
|
if (comparer == null) throw new ArgumentNullException("comparer");
|
||||||
throw new ArgumentNullException("keySelector");
|
|
||||||
if (comparer == null)
|
|
||||||
throw new ArgumentNullException("comparer");
|
|
||||||
|
|
||||||
return source.Distinct_(keySelector, comparer);
|
return source.Distinct_(keySelector, comparer);
|
||||||
}
|
}
|
||||||
@@ -272,11 +238,10 @@ namespace Squirrel
|
|||||||
{
|
{
|
||||||
var set = new HashSet<TKey>(comparer);
|
var set = new HashSet<TKey>(comparer);
|
||||||
|
|
||||||
foreach (var item in source)
|
foreach (var item in source) {
|
||||||
{
|
|
||||||
var key = keySelector(item);
|
var key = keySelector(item);
|
||||||
if (set.Add(key))
|
|
||||||
yield return item;
|
if (set.Add(key)) yield return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ namespace Squirrel
|
|||||||
{
|
{
|
||||||
public static string ExtractTitle(this IPackage package)
|
public static string ExtractTitle(this IPackage package)
|
||||||
{
|
{
|
||||||
if (package == null)
|
if (package == null) return String.Empty;
|
||||||
return String.Empty;
|
|
||||||
|
|
||||||
var title = package.Title;
|
var title = package.Title;
|
||||||
return !String.IsNullOrWhiteSpace(title) ? title : package.Id;
|
return !String.IsNullOrWhiteSpace(title) ? title : package.Id;
|
||||||
@@ -17,9 +16,8 @@ namespace Squirrel
|
|||||||
|
|
||||||
public static FrameworkVersion DetectFrameworkVersion(this IPackage package)
|
public static FrameworkVersion DetectFrameworkVersion(this IPackage package)
|
||||||
{
|
{
|
||||||
return package.GetFiles().Any(x => x.Path.Contains("lib") && x.Path.Contains("45"))
|
return package.GetFiles().Any(x => x.Path.Contains("lib") && x.Path.Contains("45")) ?
|
||||||
? FrameworkVersion.Net45
|
FrameworkVersion.Net45 : FrameworkVersion.Net40;
|
||||||
: FrameworkVersion.Net40;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,19 +54,17 @@ namespace Squirrel
|
|||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public string PackageName {
|
public string PackageName {
|
||||||
get {
|
get { return Filename.Substring(0, Filename.IndexOfAny(new[] { '-', '.' })); }
|
||||||
return Filename.Substring(0, Filename.IndexOfAny(new[] { '-', '.' }));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetReleaseNotes(string packageDirectory)
|
public string GetReleaseNotes(string packageDirectory)
|
||||||
{
|
{
|
||||||
var zp = new ZipPackage(Path.Combine(packageDirectory, Filename));
|
var zp = new ZipPackage(Path.Combine(packageDirectory, Filename));
|
||||||
|
|
||||||
var t = zp.Id;
|
var t = zp.Id;
|
||||||
|
|
||||||
if (String.IsNullOrWhiteSpace(zp.ReleaseNotes))
|
if (String.IsNullOrWhiteSpace(zp.ReleaseNotes)) {
|
||||||
throw new Exception(String.Format("Invalid 'ReleaseNotes' value in nuspec file at '{0}'", Path.Combine(packageDirectory, Filename)));
|
throw new Exception(String.Format("Invalid 'ReleaseNotes' value in nuspec file at '{0}'", Path.Combine(packageDirectory, Filename)));
|
||||||
|
}
|
||||||
|
|
||||||
return zp.ReleaseNotes;
|
return zp.ReleaseNotes;
|
||||||
}
|
}
|
||||||
@@ -186,15 +184,14 @@ namespace Squirrel
|
|||||||
|
|
||||||
public static ReleasePackage GetPreviousRelease(IEnumerable<ReleaseEntry> releaseEntries, IReleasePackage package, string targetDir)
|
public static ReleasePackage GetPreviousRelease(IEnumerable<ReleaseEntry> releaseEntries, IReleasePackage package, string targetDir)
|
||||||
{
|
{
|
||||||
if (releaseEntries == null || !releaseEntries.Any())
|
if (releaseEntries == null || !releaseEntries.Any()) return null;
|
||||||
return null;
|
|
||||||
|
|
||||||
return releaseEntries
|
return releaseEntries
|
||||||
.Where(x => x.IsDelta == false)
|
.Where(x => x.IsDelta == false)
|
||||||
.Where(x => x.Version < package.ToVersion())
|
.Where(x => x.Version < package.ToVersion())
|
||||||
.OrderByDescending(x => x.Version)
|
.OrderByDescending(x => x.Version)
|
||||||
.Select(x => new ReleasePackage(Path.Combine(targetDir, x.Filename), true))
|
.Select(x => new ReleasePackage(Path.Combine(targetDir, x.Filename), true))
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ namespace Squirrel
|
|||||||
public static Version ToVersion(this string fileName)
|
public static Version ToVersion(this string fileName)
|
||||||
{
|
{
|
||||||
var parts = (new FileInfo(fileName)).Name
|
var parts = (new FileInfo(fileName)).Name
|
||||||
.Replace(".nupkg", "").Replace("-delta", "")
|
.Replace(".nupkg", "").Replace("-delta", "")
|
||||||
.Split('.', '-').Reverse();
|
.Split('.', '-').Reverse();
|
||||||
|
|
||||||
var numberRegex = new Regex(@"^\d+$");
|
var numberRegex = new Regex(@"^\d+$");
|
||||||
|
|
||||||
@@ -28,13 +28,11 @@ namespace Squirrel
|
|||||||
.Reverse()
|
.Reverse()
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
if (versionFields.Length < 2 || versionFields.Length > 4)
|
if (versionFields.Length < 2 || versionFields.Length > 4) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (versionFields.Length)
|
switch (versionFields.Length) {
|
||||||
{
|
|
||||||
case 2:
|
case 2:
|
||||||
return new Version(versionFields[0], versionFields[1]);
|
return new Version(versionFields[0], versionFields[1]);
|
||||||
case 3:
|
case 3:
|
||||||
|
|||||||
@@ -34,14 +34,12 @@ namespace Squirrel
|
|||||||
|
|
||||||
static int? GetAssemblySquirrelAwareVersion(string executable)
|
static int? GetAssemblySquirrelAwareVersion(string executable)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
var assembly = AssemblyDefinition.ReadAssembly(executable);
|
var assembly = AssemblyDefinition.ReadAssembly(executable);
|
||||||
if (!assembly.HasCustomAttributes) return null;
|
if (!assembly.HasCustomAttributes) return null;
|
||||||
|
|
||||||
var attrs = assembly.CustomAttributes;
|
var attrs = assembly.CustomAttributes;
|
||||||
var attribute = attrs.FirstOrDefault(x =>
|
var attribute = attrs.FirstOrDefault(x => {
|
||||||
{
|
|
||||||
if (x.AttributeType.FullName != typeof(AssemblyMetadataAttribute).FullName) return false;
|
if (x.AttributeType.FullName != typeof(AssemblyMetadataAttribute).FullName) return false;
|
||||||
if (x.ConstructorArguments.Count != 2) return false;
|
if (x.ConstructorArguments.Count != 2) return false;
|
||||||
return x.ConstructorArguments[0].Value.ToString() == "SquirrelAwareVersion";
|
return x.ConstructorArguments[0].Value.ToString() == "SquirrelAwareVersion";
|
||||||
@@ -50,8 +48,7 @@ namespace Squirrel
|
|||||||
if (attribute == null) return null;
|
if (attribute == null) return null;
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
if (!Int32.TryParse(attribute.ConstructorArguments[1].Value.ToString(), NumberStyles.Integer, CultureInfo.CurrentCulture, out result))
|
if (!Int32.TryParse(attribute.ConstructorArguments[1].Value.ToString(), NumberStyles.Integer, CultureInfo.CurrentCulture, out result)) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,8 +69,7 @@ namespace Squirrel
|
|||||||
if (!NativeMethods.GetFileVersionInfo(executable, IntPtr.Zero, size, buf)) return null;
|
if (!NativeMethods.GetFileVersionInfo(executable, IntPtr.Zero, size, buf)) return null;
|
||||||
|
|
||||||
IntPtr result; int resultSize;
|
IntPtr result; int resultSize;
|
||||||
if (!NativeMethods.VerQueryValue(buf, "\\StringFileInfo\\040904B0\\SquirrelAwareVersion", out result, out resultSize))
|
if (!NativeMethods.VerQueryValue(buf, "\\StringFileInfo\\040904B0\\SquirrelAwareVersion", out result, out resultSize)) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,10 @@ namespace Squirrel
|
|||||||
// NB: When bootstrapping, CurrentlyInstalledVersion is null!
|
// NB: When bootstrapping, CurrentlyInstalledVersion is null!
|
||||||
CurrentlyInstalledVersion = currentlyInstalledVersion;
|
CurrentlyInstalledVersion = currentlyInstalledVersion;
|
||||||
ReleasesToApply = (releasesToApply ?? Enumerable.Empty<ReleaseEntry>()).ToList();
|
ReleasesToApply = (releasesToApply ?? Enumerable.Empty<ReleaseEntry>()).ToList();
|
||||||
FutureReleaseEntry = ReleasesToApply.Any()
|
FutureReleaseEntry = ReleasesToApply.Any() ?
|
||||||
? ReleasesToApply.MaxBy(x => x.Version).FirstOrDefault()
|
ReleasesToApply.MaxBy(x => x.Version).FirstOrDefault() :
|
||||||
: null;
|
null;
|
||||||
|
|
||||||
AppFrameworkVersion = appFrameworkVersion;
|
AppFrameworkVersion = appFrameworkVersion;
|
||||||
|
|
||||||
this.PackageDirectory = packageDirectory;
|
this.PackageDirectory = packageDirectory;
|
||||||
@@ -65,13 +66,15 @@ namespace Squirrel
|
|||||||
return new UpdateInfo(currentVersion, Enumerable.Empty<ReleaseEntry>(), packageDirectory, appFrameworkVersion);
|
return new UpdateInfo(currentVersion, Enumerable.Empty<ReleaseEntry>(), packageDirectory, appFrameworkVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
var newerThanUs = availableReleases.Where(x => x.Version > currentVersion.Version)
|
var newerThanUs = availableReleases
|
||||||
.OrderBy(v => v.Version);
|
.Where(x => x.Version > currentVersion.Version)
|
||||||
|
.OrderBy(v => v.Version);
|
||||||
|
|
||||||
var deltasSize = newerThanUs.Where(x => x.IsDelta).Sum(x => x.Filesize);
|
var deltasSize = newerThanUs.Where(x => x.IsDelta).Sum(x => x.Filesize);
|
||||||
|
|
||||||
return (deltasSize < latestFull.Filesize && deltasSize > 0)
|
return (deltasSize < latestFull.Filesize && deltasSize > 0) ?
|
||||||
? new UpdateInfo(currentVersion, newerThanUs.Where(x => x.IsDelta).ToArray(), packageDirectory, appFrameworkVersion)
|
new UpdateInfo(currentVersion, newerThanUs.Where(x => x.IsDelta).ToArray(), packageDirectory, appFrameworkVersion) :
|
||||||
: new UpdateInfo(currentVersion, new[] { latestFull }, packageDirectory, appFrameworkVersion);
|
new UpdateInfo(currentVersion, new[] { latestFull }, packageDirectory, appFrameworkVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ namespace Squirrel
|
|||||||
{
|
{
|
||||||
var currentRelease = getReleases().MaxBy(x => x.Name.ToVersion()).FirstOrDefault();
|
var currentRelease = getReleases().MaxBy(x => x.Name.ToVersion()).FirstOrDefault();
|
||||||
|
|
||||||
if (currentRelease.Exists)
|
if (currentRelease.Exists) {
|
||||||
{
|
|
||||||
var version = currentRelease.Name.ToVersion();
|
var version = currentRelease.Name.ToVersion();
|
||||||
|
|
||||||
await SquirrelAwareExecutableDetector.GetAllSquirrelAwareApps(currentRelease.FullName)
|
await SquirrelAwareExecutableDetector.GetAllSquirrelAwareApps(currentRelease.FullName)
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ namespace Squirrel.Tests.Core
|
|||||||
|
|
||||||
var existingTypes = GetContentTypes(expected);
|
var existingTypes = GetContentTypes(expected);
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
File.Copy(inputFile, tempFile);
|
File.Copy(inputFile, tempFile);
|
||||||
|
|
||||||
var actual = new XmlDocument();
|
var actual = new XmlDocument();
|
||||||
@@ -38,9 +37,7 @@ namespace Squirrel.Tests.Core
|
|||||||
var actualTypes = GetContentTypes(actual);
|
var actualTypes = GetContentTypes(actual);
|
||||||
|
|
||||||
Assert.Equal(existingTypes, actualTypes);
|
Assert.Equal(existingTypes, actualTypes);
|
||||||
}
|
} finally {
|
||||||
finally
|
|
||||||
{
|
|
||||||
File.Delete(tempFile);
|
File.Delete(tempFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,8 +205,7 @@ namespace Squirrel.Tests.Core
|
|||||||
var assemblyName = AssemblyName.GetAssemblyName(outputFile);
|
var assemblyName = AssemblyName.GetAssemblyName(outputFile);
|
||||||
Assert.Equal(1, assemblyName.Version.Major);
|
Assert.Equal(1, assemblyName.Version.Major);
|
||||||
Assert.Equal(5, assemblyName.Version.Minor);
|
Assert.Equal(5, assemblyName.Version.Minor);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
File.Delete(outputPackage);
|
File.Delete(outputPackage);
|
||||||
File.Delete(outputFile);
|
File.Delete(outputFile);
|
||||||
}
|
}
|
||||||
@@ -242,8 +241,7 @@ namespace Squirrel.Tests.Core
|
|||||||
var fixture = new ReleasePackage(inputPackage);
|
var fixture = new ReleasePackage(inputPackage);
|
||||||
(new DirectoryInfo(sourceDir)).Exists.ShouldBeTrue();
|
(new DirectoryInfo(sourceDir)).Exists.ShouldBeTrue();
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
fixture.CreateReleasePackage(outputPackage, sourceDir);
|
fixture.CreateReleasePackage(outputPackage, sourceDir);
|
||||||
|
|
||||||
this.Log().Info("Resulting package is at {0}", outputPackage);
|
this.Log().Info("Resulting package is at {0}", outputPackage);
|
||||||
@@ -264,9 +262,7 @@ namespace Squirrel.Tests.Core
|
|||||||
Assert.Contains("dir\\item-in-subdirectory.txt", contentFilePaths);
|
Assert.Contains("dir\\item-in-subdirectory.txt", contentFilePaths);
|
||||||
|
|
||||||
Assert.Equal(1, pkg.GetLibFiles().Count());
|
Assert.Equal(1, pkg.GetLibFiles().Count());
|
||||||
}
|
} finally {
|
||||||
finally
|
|
||||||
{
|
|
||||||
File.Delete(outputPackage);
|
File.Delete(outputPackage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,8 +277,7 @@ namespace Squirrel.Tests.Core
|
|||||||
var rightPackage = "Caliburn.Micro.1.5.2.nupkg";
|
var rightPackage = "Caliburn.Micro.1.5.2.nupkg";
|
||||||
var rightPackagePath = IntegrationTestHelper.GetPath("fixtures", rightPackage);
|
var rightPackagePath = IntegrationTestHelper.GetPath("fixtures", rightPackage);
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
var sourceDir = IntegrationTestHelper.GetPath("fixtures", "packages");
|
var sourceDir = IntegrationTestHelper.GetPath("fixtures", "packages");
|
||||||
(new DirectoryInfo(sourceDir)).Exists.ShouldBeTrue();
|
(new DirectoryInfo(sourceDir)).Exists.ShouldBeTrue();
|
||||||
|
|
||||||
@@ -298,9 +293,7 @@ namespace Squirrel.Tests.Core
|
|||||||
.FirstOrDefault(f => f.TargetFramework == FrameworkTargetVersion.Net45);
|
.FirstOrDefault(f => f.TargetFramework == FrameworkTargetVersion.Net45);
|
||||||
|
|
||||||
Assert.NotNull(dependency);
|
Assert.NotNull(dependency);
|
||||||
}
|
} finally {
|
||||||
finally
|
|
||||||
{
|
|
||||||
File.Delete(outputPackage);
|
File.Delete(outputPackage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,8 +85,7 @@ namespace Squirrel.Tests
|
|||||||
"Squirrel.Core.1.0.0.0-full.nupkg",
|
"Squirrel.Core.1.0.0.0-full.nupkg",
|
||||||
"Squirrel.Core.1.1.0.0-delta.nupkg",
|
"Squirrel.Core.1.1.0.0-delta.nupkg",
|
||||||
"Squirrel.Core.1.1.0.0-full.nupkg",
|
"Squirrel.Core.1.1.0.0-full.nupkg",
|
||||||
}.ForEach(x =>
|
}.ForEach(x => {
|
||||||
{
|
|
||||||
var path = IntegrationTestHelper.GetPath("fixtures", x);
|
var path = IntegrationTestHelper.GetPath("fixtures", x);
|
||||||
File.Copy(path, Path.Combine(localPackages, x));
|
File.Copy(path, Path.Combine(localPackages, x));
|
||||||
File.Copy(path, Path.Combine(remotePackages, x));
|
File.Copy(path, Path.Combine(remotePackages, x));
|
||||||
@@ -125,8 +124,7 @@ namespace Squirrel.Tests
|
|||||||
"Squirrel.Core.1.0.0.0-full.nupkg",
|
"Squirrel.Core.1.0.0.0-full.nupkg",
|
||||||
"Squirrel.Core.1.1.0.0-delta.nupkg",
|
"Squirrel.Core.1.1.0.0-delta.nupkg",
|
||||||
"Squirrel.Core.1.1.0.0-full.nupkg",
|
"Squirrel.Core.1.1.0.0-full.nupkg",
|
||||||
}.ForEach(x =>
|
}.ForEach(x => {
|
||||||
{
|
|
||||||
var path = IntegrationTestHelper.GetPath("fixtures", x);
|
var path = IntegrationTestHelper.GetPath("fixtures", x);
|
||||||
File.Copy(path, Path.Combine(localPackages, x));
|
File.Copy(path, Path.Combine(localPackages, x));
|
||||||
});
|
});
|
||||||
@@ -134,8 +132,7 @@ namespace Squirrel.Tests
|
|||||||
new[] {
|
new[] {
|
||||||
"Squirrel.Core.1.0.0.0-full.nupkg",
|
"Squirrel.Core.1.0.0.0-full.nupkg",
|
||||||
"Squirrel.Core.1.1.0.0-full.nupkg",
|
"Squirrel.Core.1.1.0.0-full.nupkg",
|
||||||
}.ForEach(x =>
|
}.ForEach(x => {
|
||||||
{
|
|
||||||
var path = IntegrationTestHelper.GetPath("fixtures", x);
|
var path = IntegrationTestHelper.GetPath("fixtures", x);
|
||||||
File.Copy(path, Path.Combine(remotePackages, x));
|
File.Copy(path, Path.Combine(remotePackages, x));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ namespace Squirrel.Tests.Core
|
|||||||
{
|
{
|
||||||
string tempDir;
|
string tempDir;
|
||||||
using (Utility.WithTempDirectory(out tempDir)) {
|
using (Utility.WithTempDirectory(out tempDir)) {
|
||||||
|
|
||||||
for (var i = 0; i < 50; i++) {
|
for (var i = 0; i < 50; i++) {
|
||||||
var directory = Path.Combine(tempDir, newId());
|
var directory = Path.Combine(tempDir, newId());
|
||||||
CreateSampleDirectory(directory);
|
CreateSampleDirectory(directory);
|
||||||
@@ -64,6 +63,7 @@ namespace Squirrel.Tests.Core
|
|||||||
|
|
||||||
static void CreateSampleDirectory(string directory)
|
static void CreateSampleDirectory(string directory)
|
||||||
{
|
{
|
||||||
|
Random prng = new Random();
|
||||||
while (true) {
|
while (true) {
|
||||||
Directory.CreateDirectory(directory);
|
Directory.CreateDirectory(directory);
|
||||||
|
|
||||||
@@ -73,12 +73,13 @@ namespace Squirrel.Tests.Core
|
|||||||
File.WriteAllText(file, Guid.NewGuid().ToString());
|
File.WriteAllText(file, Guid.NewGuid().ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new Random().NextDouble() > 0.5) {
|
if (prng.NextDouble() > 0.5) {
|
||||||
var childDirectory = Path.Combine(directory, newId());
|
var childDirectory = Path.Combine(directory, newId());
|
||||||
if (childDirectory.Length > 248) return;
|
if (childDirectory.Length > 248) return;
|
||||||
directory = childDirectory;
|
directory = childDirectory;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user