diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index e464a79..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": ".NET Core Launch (console)", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build", - "program": "${workspaceRoot}/bin/Debug//", - "args": [], - "cwd": "${workspaceRoot}", - "externalConsole": false, - "stopAtEntry": false, - "internalConsoleOptions": "openOnSessionStart" - }, - { - "name": ".NET Core Attach", - "type": "coreclr", - "request": "attach", - "processId": "${command.pickProcess}" - } - ] -} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index c73077e..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "0.1.0", - "command": "dotnet", - "isShellCommand": true, - "args": [], - "tasks": [ - { - "taskName": "build", - "args": [ - "" - ], - "isBuildCommand": true, - "problemMatcher": "$msCompile" - } - ] -} \ No newline at end of file diff --git a/Coverage.ps1 b/Coverage.ps1 index f14d545..be155c2 100644 --- a/Coverage.ps1 +++ b/Coverage.ps1 @@ -3,9 +3,9 @@ if($env:APPVEYOR_REPO_TAG -eq "true") "do not publish coverall data on tag builds" return } -nuget install OpenCover -Version 4.6.519 -OutputDirectory tools -nuget install coveralls.net -Version 0.7.0 -OutputDirectory tools +nuget install OpenCover -Source https://api.nuget.org/v3/index.json -Version 4.6.519 -OutputDirectory tools +nuget install coveralls.net -Source https://api.nuget.org/v3/index.json -Version 0.7.0 -OutputDirectory tools -.\tools\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:"C:\Program Files\dotnet\dotnet.exe" -targetargs:" test "".\src\UriBuilder.Fluent.UnitTests"" -f net461" -register:user -filter:"+[UriBuilder*]* -[*Tests]*" -returntargetcode -output:opencover_results.xml +.\tools\OpenCover.4.6.519\tools\OpenCover.Console.exe -oldStyle -target:"C:\Program Files\dotnet\dotnet.exe" -targetargs:" test "".\src\UriBuilder.Fluent.UnitTests\UriBuilder.Fluent.UnitTests.csproj"" -f net461 --no-build" -register:user -filter:"+[UriBuilder*]* -[*Tests]*" -returntargetcode -output:opencover_results.xml .\tools\coveralls.net.0.7.0\tools\csmacnz.Coveralls.exe --opencover -i .\opencover_results.xml \ No newline at end of file diff --git a/UriBuilder.Fluent.sln b/UriBuilder.Fluent.sln index 34ef1a2..78c1153 100644 --- a/UriBuilder.Fluent.sln +++ b/UriBuilder.Fluent.sln @@ -1,20 +1,19 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B4EB6F69-0F56-4875-95AD-E4DEB5D18A74}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AC680F4D-C1B2-4F06-8464-CC987B1F0008}" ProjectSection(SolutionItems) = preProject appveyor.yml = appveyor.yml - global.json = global.json Readme.md = Readme.md EndProjectSection EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "UriBuilder.Fluent", "src\UriBuilder.Fluent\UriBuilder.Fluent.xproj", "{B8458F59-DEBD-4844-AA29-EE3B4388AA7A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UriBuilder.Fluent", "src\UriBuilder.Fluent\UriBuilder.Fluent.csproj", "{B8458F59-DEBD-4844-AA29-EE3B4388AA7A}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "UriBuilder.Fluent.UnitTests", "src\UriBuilder.Fluent.UnitTests\UriBuilder.Fluent.UnitTests.xproj", "{F421A9EE-180C-413E-A0CD-665295825646}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UriBuilder.Fluent.UnitTests", "src\UriBuilder.Fluent.UnitTests\UriBuilder.Fluent.UnitTests.csproj", "{F421A9EE-180C-413E-A0CD-665295825646}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/appveyor.yml b/appveyor.yml index fb44c71..e0550c5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,30 +1,24 @@ +image: Visual Studio 2017 configuration: Release version: 1.0.{build} -nuget: - account_feed: true - project_feed: true artifacts: - - path: 'src\**\*.nupkg' +- path: output\**.nupkg init: - git config --global core.autocrlf true - -before_build: -- ps: invoke-webrequest https://go.microsoft.com/fwlink/?LinkID=827524 -OutFile core.exe -- ps: .\core.exe /install /quiet /norestart build_script: -- ps: dotnet restore -- ps: dotnet build -c Release .\src\UriBuilder.Fluent -- ps: dotnet build -c Release .\src\UriBuilder.Fluent.UnitTests +- ps: >- + dotnet restore UriBuilder.Fluent.sln --source https://api.nuget.org/v3/index.json + dotnet build UriBuilder.Fluent.sln --configuration Release + if($env:APPVEYOR_REPO_TAG -eq "true") + { + dotnet pack src\UriBuilder.Fluent\UriBuilder.Fluent.csproj --configuration Release --output ..\..\output /p:Version=$env:APPVEYOR_REPO_TAG_NAME + } test_script: -- ps: dotnet test -c Release .\src\UriBuilder.Fluent.UnitTests -- ps: .\Coverage.ps1 -- ps: .\update-projectjson.ps1 -- ps: dotnet restore -- ps: dotnet pack -c Release .\src\UriBuilder.Fluent +- ps: dotnet test -c Release .\src\UriBuilder.Fluent.UnitTests\UriBuilder.Fluent.UnitTests.csproj deploy: - provider: NuGet diff --git a/global.json b/global.json deleted file mode 100644 index 9d09ab5..0000000 --- a/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "projects": [ "src", "test" ], - "sdk": { - "version": "1.0.0-preview2-003131" - } -} diff --git a/src/UriBuilder.Fluent.UnitTests/ExtensionTests.cs b/src/UriBuilder.Fluent.UnitTests/ExtensionTests.cs index 238fbd2..6aef3cb 100644 --- a/src/UriBuilder.Fluent.UnitTests/ExtensionTests.cs +++ b/src/UriBuilder.Fluent.UnitTests/ExtensionTests.cs @@ -78,6 +78,22 @@ namespace FluentUriBuilder.Tests Assert.Equal(url.Port, 22); } + [Fact] + public void WithoutDefaultPort() + { + var url = new UriBuilder("http://awesome.com:80") + .WithoutDefaultPort(); + Assert.Equal("http://awesome.com/", url.Uri.ToString()); + + url = new UriBuilder("http://awesome.com:443") + .WithoutDefaultPort(); + Assert.Equal("http://awesome.com:443/", url.Uri.ToString()); + + url = new UriBuilder("https://awesome.com:443") + .WithoutDefaultPort(); + Assert.Equal("https://awesome.com/", url.Uri.ToString()); + } + [Fact] public void WithHttps() { diff --git a/src/UriBuilder.Fluent.UnitTests/Properties/AssemblyInfo.cs b/src/UriBuilder.Fluent.UnitTests/Properties/AssemblyInfo.cs index b647517..b73dd37 100644 --- a/src/UriBuilder.Fluent.UnitTests/Properties/AssemblyInfo.cs +++ b/src/UriBuilder.Fluent.UnitTests/Properties/AssemblyInfo.cs @@ -5,10 +5,7 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("UriBuilder.Fluent.UnitTests")] -[assembly: AssemblyTrademark("")] + // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from diff --git a/src/UriBuilder.Fluent.UnitTests/UriBuilder.Fluent.UnitTests.csproj b/src/UriBuilder.Fluent.UnitTests/UriBuilder.Fluent.UnitTests.csproj new file mode 100644 index 0000000..fd6d31d --- /dev/null +++ b/src/UriBuilder.Fluent.UnitTests/UriBuilder.Fluent.UnitTests.csproj @@ -0,0 +1,14 @@ + + + netcoreapp1.1;net461 + full + + + + + + + + + + \ No newline at end of file diff --git a/src/UriBuilder.Fluent.UnitTests/UriBuilder.Fluent.UnitTests.xproj b/src/UriBuilder.Fluent.UnitTests/UriBuilder.Fluent.UnitTests.xproj deleted file mode 100644 index 0de6deb..0000000 --- a/src/UriBuilder.Fluent.UnitTests/UriBuilder.Fluent.UnitTests.xproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - f421a9ee-180c-413e-a0cd-665295825646 - UriBuilder.Fluent.UnitTests - .\obj - .\bin\ - v4.5.2 - - - 2.0 - - - - - - \ No newline at end of file diff --git a/src/UriBuilder.Fluent.UnitTests/UriBuilder.Fluent.UnitTests.xproj.user b/src/UriBuilder.Fluent.UnitTests/UriBuilder.Fluent.UnitTests.xproj.user deleted file mode 100644 index c99c608..0000000 --- a/src/UriBuilder.Fluent.UnitTests/UriBuilder.Fluent.UnitTests.xproj.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - Start - - \ No newline at end of file diff --git a/src/UriBuilder.Fluent.UnitTests/project.json b/src/UriBuilder.Fluent.UnitTests/project.json deleted file mode 100644 index 8dbb8b4..0000000 --- a/src/UriBuilder.Fluent.UnitTests/project.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "version": "1.0.0-*", - "testRunner": "xunit", - - "dependencies": { - "xunit": "2.2.0-beta2-build3300", - "dotnet-test-xunit": "2.2.0-preview2-build1029", - "UriBuilder.Fluent": "1.0.0-*" - }, - - "frameworks": { - "net461":{}, - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} \ No newline at end of file diff --git a/src/UriBuilder.Fluent/Properties/AssemblyInfo.cs b/src/UriBuilder.Fluent/Properties/AssemblyInfo.cs index 5843dcc..bd59ce9 100644 --- a/src/UriBuilder.Fluent/Properties/AssemblyInfo.cs +++ b/src/UriBuilder.Fluent/Properties/AssemblyInfo.cs @@ -5,10 +5,6 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("UriBuilder.Fluent")] -[assembly: AssemblyTrademark("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from diff --git a/src/UriBuilder.Fluent/TerribleDevUriExtensions.cs b/src/UriBuilder.Fluent/TerribleDevUriExtensions.cs index 357e8b7..06641aa 100644 --- a/src/UriBuilder.Fluent/TerribleDevUriExtensions.cs +++ b/src/UriBuilder.Fluent/TerribleDevUriExtensions.cs @@ -81,6 +81,17 @@ namespace System return bld; } + /// + /// Removes the port number for default ports + /// + /// + /// + public static UriBuilder WithoutDefaultPort(this UriBuilder bld) + { + if (bld.Uri.IsDefaultPort) bld.Port = -1; + return bld; + } + /// /// appends a path segment to the path. Can be called multiple times to append multiple segments /// diff --git a/src/UriBuilder.Fluent/UriBuilder.Fluent.csproj b/src/UriBuilder.Fluent/UriBuilder.Fluent.csproj new file mode 100644 index 0000000..d80ff44 --- /dev/null +++ b/src/UriBuilder.Fluent/UriBuilder.Fluent.csproj @@ -0,0 +1,23 @@ + + + + Tommy Parnell + netstandard1.1;net40;net45 + UriBuilder.Fluent + UriBuilder.Fluent + Url building;Uri;Uri building;fluent;extension + https://github.com/TerribleDev/UriBuilder.Fluent + full + + + + + + + + + + + + + diff --git a/src/UriBuilder.Fluent/UriBuilder.Fluent.xproj b/src/UriBuilder.Fluent/UriBuilder.Fluent.xproj deleted file mode 100644 index d1dbff1..0000000 --- a/src/UriBuilder.Fluent/UriBuilder.Fluent.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - b8458f59-debd-4844-aa29-ee3b4388aa7a - UriBuilder.Fluent - .\obj - .\bin\ - v4.5.2 - - - - 2.0 - - - diff --git a/src/UriBuilder.Fluent/UriBuilder.Fluent.xproj.user b/src/UriBuilder.Fluent/UriBuilder.Fluent.xproj.user deleted file mode 100644 index c99c608..0000000 --- a/src/UriBuilder.Fluent/UriBuilder.Fluent.xproj.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - Start - - \ No newline at end of file diff --git a/src/UriBuilder.Fluent/project.json b/src/UriBuilder.Fluent/project.json deleted file mode 100644 index e7196e3..0000000 --- a/src/UriBuilder.Fluent/project.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "version": "1.0.0-*", - "packOptions": { - "owners": [ - "Tommy Parnell" - ], - "projectUrl": "https://github.com/TerribleDev/UriBuilder.Fluent", - "summary": "Fluent extensions for UriBuilder", - "tags": [ - "Url building", - "Uri", - "Uri building", - "fluent", - "extension" - ] - }, - "authors": [ - "Tommy Parnell" - ], - "frameworks": { - "netstandard1.1": { - "imports": "dnxcore50", - "dependencies": { - "NETStandard.Library": "1.6.0" - } - }, - "net40": { - "imports": "dnxcore50" - }, - "net45":{} - } -} diff --git a/update-projectjson.ps1 b/update-projectjson.ps1 deleted file mode 100644 index aa42f15..0000000 --- a/update-projectjson.ps1 +++ /dev/null @@ -1,16 +0,0 @@ -$projectJsonFileLocation = "src/UriBuilder.Fluent/project.json" -$newVersion = $env:APPVEYOR_REPO_TAG_NAME -if($newVersion -eq $null) -{ - $newVersion = "1.0.0-${env:APPVEYOR_BUILD_NUMBER}" -} -if($newVersion -eq $null) -{ - return -} - -Write-Host "$projectJsonFileLocation will be update with new version '$newVersion'" - -$json = (Get-Content $projectJsonFileLocation -Raw) | ConvertFrom-Json -$json.version = $newVersion -$json | ConvertTo-Json -depth 100 | Out-File $projectJsonFileLocation \ No newline at end of file