Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for overriding repository url, version and uploading multiple packages simultaneously using a glob pattern (wildcards) #53

Merged
merged 43 commits into from
Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f30e12d
Add support for overriding nuspec repository url and version before p…
peters Jun 12, 2020
3d5de9a
Add support for wildcards when pushing. Fixes #30
peters Jun 13, 2020
1f7699f
Add additional test cases. Ref. https://github.com/jcansdale/gpr/pull…
peters Jun 15, 2020
78258d6
Add support for *.snupkg (symbol packages) and parallelization allowi…
peters Jun 15, 2020
5874ae5
Add additional test cases.
peters Jun 15, 2020
8810332
Ignore repository type when determining if we should rewrite nupkg as…
peters Jun 15, 2020
30e1dd8
If --repository option is not supplied then read <RepositoryUrl /> fr…
peters Jun 15, 2020
dfa4ec4
Add support for wildcards (glob patterns), symbol packages (.snupkg) …
peters Jun 15, 2020
554e459
Remove all whitespace tokens after reading access token.
peters Jun 15, 2020
a114198
Add test case that proves whitespace is removed from repository url.
peters Jun 15, 2020
7677bb7
Add shorthand syntax for new push command options.
peters Jun 15, 2020
c3cb47a
Fix bad formatting.
peters Jun 15, 2020
1f417fd
Merge branch 'master' into issue-48
peters Jun 15, 2020
328a018
Add additional test cases.
peters Jun 15, 2020
a47485d
Add retry policy in order to deal with intermittent connection issue.
peters Jun 15, 2020
f870f07
Bugfix: Support relative urls. E.g owner/repositoryname. Also always …
peters Jun 15, 2020
50878c5
Add support for expanding a relative path combined with a base direct…
peters Jun 15, 2020
fe86d60
Cancel push if "CTRL - C" is pressed.
peters Jun 16, 2020
e3cb47a
Address latest feedback.
peters Jun 16, 2020
6daa0cd
Add support for cancellation of all commands and return non-zero exit…
peters Jun 16, 2020
7125edb
Update src/GprTool/Program.cs
peters Jun 16, 2020
236e99b
Add environment variable for debugging. The process will wait until d…
peters Jun 16, 2020
6b0c324
Optimize package search by moving check if nupkg should be written in…
peters Jun 16, 2020
8949086
Remove unused variable.
peters Jun 16, 2020
063f22f
R#
peters Jun 16, 2020
daf0551
If PackageFilename is a directory then we should by default upload al…
peters Jun 16, 2020
4a8df4c
Implicitly cast workingdirectory to string.
peters Jun 16, 2020
623bfce
Use full path in glob
jcansdale Jun 16, 2020
04fd2b4
Refactor: Expand path before parsing glob pattern. Added test cases f…
peters Jun 16, 2020
8fd11e6
Add additional test cases.
peters Jun 16, 2020
be0e251
Update nuget packages. Maybe consider enabling depandabot? /cc @jcans…
peters Jun 16, 2020
b94c540
Enable running tests via commandline: dotnet test . --logger:nunit /p…
peters Jun 16, 2020
4092898
Change package output path root solution directory.
peters Jun 16, 2020
9b823ad
Add global json.
peters Jun 16, 2020
38b72ee
Fix failing test cases on Unix.
peters Jun 17, 2020
9523c16
PackageOutputPath is already defined in Directory.Build.Props.
peters Jun 17, 2020
8fac910
Update src/GprTool/NuGetUtilities.cs
peters Jun 17, 2020
ec536b0
Ignore nupkgs directory.
peters Jun 17, 2020
d253600
Merge branch 'issue-48' of https://github.com/peters/gpr into issue-48
peters Jun 17, 2020
47f0409
Remove FilenameWithoutGprPrefix and use ".zip" extension when rewriti…
peters Jun 17, 2020
8af6bda
Add support for accepting multiple filenames (relative or absolute) a…
peters Jun 17, 2020
237eef7
Enable OSX support.
peters Jun 17, 2020
0294e2c
Update test syntax because packages list may be sorted differently ba…
peters Jun 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/GprTool/NuGetUtilities.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using NuGet.Packaging;
Expand All @@ -14,7 +13,6 @@ public class NuGetUtilities
public static bool ShouldRewriteNupkg(string nupkgPath, string repositoryUrl, NuGetVersion nuGetVersion = null)
{
if (nupkgPath == null) throw new ArgumentNullException(nameof(nupkgPath));
if (repositoryUrl == null) throw new ArgumentNullException(nameof(repositoryUrl));

using var packageArchiveReader = new PackageArchiveReader(nupkgPath.OpenReadShared(), false);

Expand All @@ -36,10 +34,8 @@ public static bool ShouldRewriteNupkg(string nupkgPath, string repositoryUrl, Nu
}

var nuspecRepositoryUrl = repositoryXElement.Attribute("url")?.Value;
var nuspecRepositoryType = repositoryXElement.Attribute("type")?.Value;

return !string.Equals(repositoryUrl, nuspecRepositoryUrl, StringComparison.Ordinal)
|| !string.Equals("git", nuspecRepositoryType, StringComparison.Ordinal);

return !string.Equals(repositoryUrl, nuspecRepositoryUrl, StringComparison.Ordinal);
jcansdale marked this conversation as resolved.
Show resolved Hide resolved
}

public static string RewriteNupkg(string nupkgPath, string repositoryUrl, NuGetVersion nuGetVersion = null)
Expand Down
25 changes: 24 additions & 1 deletion test/GprTool.Tests/NuGetUtilitiesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ public void UpdatePackageSourceCredentials()
Assert.That(packageSourceCredentialsElements.Count, Is.EqualTo(1));
}

[TestCase("1.0.0", "1.0.0", false)]
[TestCase("1.0.0", "1.0.0", false)]
[TestCase("1.0.0", "1.0.1", true)]
public void ShouldRewriteNupkg_Version(string currentVersion, string updatedVersion, bool shouldUpdateVersion)
Expand Down Expand Up @@ -193,6 +192,30 @@ public void ShouldRewriteNupkg_RepositoryUrl(string currentRepositoryUrl, string
updatedRepositoryUrl), Is.EqualTo(shouldUpdateRepositoryUrl));
}

[TestCase(null)]
[TestCase("randomvalue")]
[TestCase("git")]
public void ShouldRewriteNupkg_Ignores_RepositoryType(string repositoryType)
{
const string currentRepositoryUrl = "https://github.com/jcansdale/gpr";

using var packageBuilderContext = new PackageBuilderContext(TmpDirectoryPath, new NuspecContext(manifest =>
{
manifest.Metadata.Repository = new RepositoryMetadata
{
Url = currentRepositoryUrl,
Type = repositoryType
};
}));

packageBuilderContext.Build();

Assert.That(
NuGetUtilities.ShouldRewriteNupkg(
packageBuilderContext.NupkgFilename,
repositoryType), Is.EqualTo(true));
}

[TestCase("https://github.com/owner/repo.git", "https://github.com/owner/repo.git")]
[TestCase("https://github.com/owner/repo", "https://github.com/owner/repo")]
public void RewriteNuspec(string repositoryUrl, string expectedRepositoryUrl)
Expand Down