From 46c5c8918a3db1d171ad329ee3444284cda93e85 Mon Sep 17 00:00:00 2001 From: Mark Hajek Date: Mon, 3 May 2021 18:07:27 +0100 Subject: [PATCH 1/4] replaced direct quoting with usage of .EscapeForShell() --- ModernRonin.ProjectRenamer/Git.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ModernRonin.ProjectRenamer/Git.cs b/ModernRonin.ProjectRenamer/Git.cs index 9354373..9fcee1f 100644 --- a/ModernRonin.ProjectRenamer/Git.cs +++ b/ModernRonin.ProjectRenamer/Git.cs @@ -38,7 +38,9 @@ void run(string arguments) => public string GetVersion() => Read("--version"); - public void Move(string oldPath, string newPath) => Run($"mv \"{oldPath}\" \"{newPath}\""); + public void Move(string oldPath, string newPath) => + Run($"mv {oldPath.EscapeForShell()} {newPath.EscapeForShell()}"); + public void RollbackAllChanges() => Run("reset --hard HEAD", () => { }); public void StageAllChanges() => Run("add ."); @@ -50,4 +52,4 @@ string Read(string arguments) => void Run(string arguments, Action onNonZeroExitCode) => _executor.Tool(ToolGit, arguments, onNonZeroExitCode); } -} +} \ No newline at end of file From 91455c6e0ed8a11711046f049a8ecd386f27828f Mon Sep 17 00:00:00 2001 From: Mark Hajek Date: Mon, 3 May 2021 18:09:04 +0100 Subject: [PATCH 2/4] updated version --- ModernRonin.ProjectRenamer/release.history | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ModernRonin.ProjectRenamer/release.history b/ModernRonin.ProjectRenamer/release.history index 96b3e1f..ae2d3ba 100644 --- a/ModernRonin.ProjectRenamer/release.history +++ b/ModernRonin.ProjectRenamer/release.history @@ -1,7 +1,9 @@  - 2.1.3 + 2.1.4 +2.1.4: +* bugfix: fixed issue when paths contained whitespace; thanks to @jakubmaguza for the PR - the first contribution from anyone else :-) 2.1.3: * bugfix: fixed a bug concerning nested solution folders; thanks to @Mike-E-angelo for reporting the bug 2.1.2: From a9556e5158cf0f9ceb54c78606da745c5a58583d Mon Sep 17 00:00:00 2001 From: Mark Hajek Date: Mon, 3 May 2021 18:10:43 +0100 Subject: [PATCH 3/4] updated readme --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 07a43f5..d7236c8 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,11 @@ dotnet tool update --global ModernRonin.ProjectRenamer When I publish a new version, I always post at [my blog](https://modernronin.github.io/) under the [renameproject tag](https://modernronin.github.io/tags/renameproject/), aside from updating this readme here. ### Release History +2.1.4: +* bugfix: fixed issue when paths contained whitespace; thanks to [@jakubmaguza](https://github.com/jakubmaguza) for the PR - the first contribution from anyone else :-) + 2.1.3: -* bugfix: fixed a bug concerning nested solution folders; thanks to @Mike-E-angelo for reporting the bug +* bugfix: fixed a bug concerning nested solution folders; thanks to [@Mike-E-angelo](https://github.com/mike-e-angelo) for reporting the bug 2.1.2: * bugfix: fixed another whitespace related scenario; thanks to [@sejohnson-at-griffis](https://github.com/sejohnson-at-griffis) for reporting the bug From 479d107b514c5a5bb3b8d6ab7dc1d4f3a1cd5131 Mon Sep 17 00:00:00 2001 From: Mark Hajek Date: Mon, 3 May 2021 18:38:40 +0100 Subject: [PATCH 4/4] made the script smarter so it can be used from within a github action --- push-package.ps1 | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/push-package.ps1 b/push-package.ps1 index f351baa..d34e01c 100644 --- a/push-package.ps1 +++ b/push-package.ps1 @@ -1,6 +1,22 @@ -param ([parameter(mandatory)]$version) +param ($version) -if (-not $nugetApiKey) {Write-Host "You need to set the variable nugetApiKey"} +if (-not $nugetApiKey) {$nugetApiKey= $Env:NUGETAPIKEY} +if (-not $nugetApiKey) +{ + Write-Host "You need to either set the powershell variable nugetApiKey or the environment variable NUGETAPIKEY before executing this script" + exit +} + +if (-not $version) +{ + [xml]$xml= Get-Content .\ModernRonin.ProjectRenamer\release.history + $version= $xml.Project.PropertyGroup.Version.ToString() +} +if (-not $version) +{ + Write-Host "Something went wrong, could not read version from release.history" + exit +} dotnet pack --configuration Release dotnet nuget push .\ModernRonin.ProjectRenamer\nupkg\ModernRonin.ProjectRenamer.$version.nupkg -s https://api.nuget.org/v3/index.json --api-key $nugetApiKey \ No newline at end of file