diff --git a/README.md b/README.md index 0286760..9f082e3 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,20 @@ This NuGet package contains code for parsing Team Foundation Server URLs. -[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/bbtsoftwareag/TfsUrlParser/blob/feature/build/LICENSE) +[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/bbtsoftware/TfsUrlParser/blob/master/LICENSE) ## Information | | Stable | Pre-release | |:--:|:--:|:--:| -|GitHub Release|-|[![GitHub release](https://img.shields.io/github/release/bbtsoftwareag/TfsUrlParser.svg)](https://github.com/bbtsoftwareag/TfsUrlParser/releases/latest)| +|GitHub Release|-|[![GitHub release](https://img.shields.io/github/release/bbtsoftware/TfsUrlParser.svg)](https://github.com/bbtsoftware/TfsUrlParser/releases/latest)| |NuGet|[![NuGet](https://img.shields.io/nuget/v/TfsUrlParser.svg)](https://www.nuget.org/packages/TfsUrlParser)|[![NuGet](https://img.shields.io/nuget/vpre/TfsUrlParser.svg)](https://www.nuget.org/packages/TfsUrlParser)| ## Build Status |Develop|Master| |:--:|:--:| -|[![Build status](https://ci.appveyor.com/api/projects/status/i4evodvrv7qc9e6y/branch/develop?svg=true)](https://ci.appveyor.com/project/BBTSoftwareAG/tfsurlparser/branch/develop)|[![Build status](https://ci.appveyor.com/api/projects/status/i4evodvrv7qc9e6y?svg=true)](https://ci.appveyor.com/project/BBTSoftwareAG/tfsurlparser)| +|[![Build status](https://ci.appveyor.com/api/projects/status/i4evodvrv7qc9e6y/branch/develop?svg=true)](https://ci.appveyor.com/project/BBTSoftwareAG/tfsurlparser/branch/develop)|[![Build status](https://ci.appveyor.com/api/projects/status/i4evodvrv7qc9e6y/branch/master?svg=true)](https://ci.appveyor.com/project/BBTSoftwareAG/tfsurlparser/branch/master)| ## Code Coverage diff --git a/nuspec/nuget/TfsUrlParser.nuspec b/nuspec/nuget/TfsUrlParser.nuspec index 3d470db..d1c447a 100644 --- a/nuspec/nuget/TfsUrlParser.nuspec +++ b/nuspec/nuget/TfsUrlParser.nuspec @@ -8,16 +8,17 @@ bbtsoftware, pascalberger Provides a parser for Team Foundation Server (TFS) URLs. Provides a parser to get repository information from a Team Foundation Server (TFS) URLs. - https://github.com/bbtsoftwareag/TfsUrlParser/blob/develop/LICENSE - https://github.com/bbtsoftwareag/TfsUrlParser/ - https://raw.githubusercontent.com/bbtsoftwareag/TfsUrlParser/fdaa354eef80c05070c93ef14b6774abe7eeac73/nuspec/nuget/icon.png + https://github.com/bbtsoftware/TfsUrlParser/blob/develop/LICENSE + https://github.com/bbtsoftware/TfsUrlParser/ + https://raw.githubusercontent.com/bbtsoftware/TfsUrlParser/fdaa354eef80c05070c93ef14b6774abe7eeac73/nuspec/nuget/icon.png false Copyright © 2017 BBT Software AG, Root/Zermatt, Switzerland TeamFoundationServer TFS Git Parser + https://github.com/bbtsoftware/TfsUrlParser/releases/tag/1.1.0 - \ No newline at end of file + diff --git a/setup.cake b/setup.cake index 441e7c6..8011256 100644 --- a/setup.cake +++ b/setup.cake @@ -7,9 +7,9 @@ BuildParameters.SetParameters( buildSystem: BuildSystem, sourceDirectoryPath: "./src", title: "TfsUrlParser", - repositoryOwner: "bbtsoftwareag", + repositoryOwner: "bbtsoftware", repositoryName: "TfsUrlParser", - appVeyorAccountName: "bbtsoftwareag", + appVeyorAccountName: "BBTSoftwareAG", shouldPublishMyGet: false); BuildParameters.PrintParameters(Context); diff --git a/src/TfsUrlParser.Tests/RepositoryDescriptionTests.cs b/src/TfsUrlParser.Tests/RepositoryDescriptionTests.cs index e07f605..9bbe942 100644 --- a/src/TfsUrlParser.Tests/RepositoryDescriptionTests.cs +++ b/src/TfsUrlParser.Tests/RepositoryDescriptionTests.cs @@ -31,106 +31,123 @@ public void Should_Throw_If_No_Valid_Url(string repoUrl, string expectedMessage) [Theory] [InlineData( @"http://myserver:8080/tfs/defaultcollection/myproject/_git/myrepository", + @"http://myserver:8080/", "defaultcollection", @"http://myserver:8080/tfs/defaultcollection", "myproject", "myrepository")] [InlineData( @"http://tfs.myserver/defaultcollection/myproject/_git/myrepository", + @"http://tfs.myserver/", "defaultcollection", @"http://tfs.myserver/defaultcollection", "myproject", "myrepository")] [InlineData( @"http://mytenant.visualstudio.com/defaultcollection/myproject/_git/myrepository", + @"http://mytenant.visualstudio.com/", "defaultcollection", @"http://mytenant.visualstudio.com/defaultcollection", "myproject", "myrepository")] [InlineData( @"http://tfs.foo.com/foo/foo/_git/foo", + @"http://tfs.foo.com/", "foo", @"http://tfs.foo.com/foo", "foo", "foo")] [InlineData( @"http://mytenant.visualstudio.com/defaultcollection/myproject/_git/myrepository/somethingelse", + @"http://mytenant.visualstudio.com/", "defaultcollection", @"http://mytenant.visualstudio.com/defaultcollection", "myproject", "myrepository")] [InlineData( @"https://myserver:8080/tfs/defaultcollection/myproject/_git/myrepository", + @"https://myserver:8080/", "defaultcollection", @"https://myserver:8080/tfs/defaultcollection", "myproject", "myrepository")] [InlineData( @"https://tfs.myserver/defaultcollection/myproject/_git/myrepository", + @"https://tfs.myserver/", "defaultcollection", @"https://tfs.myserver/defaultcollection", "myproject", "myrepository")] [InlineData( @"https://mytenant.visualstudio.com/defaultcollection/myproject/_git/myrepository", + @"https://mytenant.visualstudio.com/", "defaultcollection", @"https://mytenant.visualstudio.com/defaultcollection", "myproject", "myrepository")] [InlineData( @"https://mytenant.visualstudio.com/defaultcollection/myproject/_git/myrepository/somethingelse", + @"https://mytenant.visualstudio.com/", "defaultcollection", @"https://mytenant.visualstudio.com/defaultcollection", "myproject", "myrepository")] [InlineData( @"https://tfs.foo.com/foo/foo/_git/foo", + @"https://tfs.foo.com/", "foo", @"https://tfs.foo.com/foo", "foo", "foo")] [InlineData( @"ssh://myserver:8080/tfs/defaultcollection/myproject/_git/myrepository", + @"ssh://myserver:8080/", "defaultcollection", @"https://myserver:8080/tfs/defaultcollection", "myproject", "myrepository")] [InlineData( @"ssh://tfs.myserver/defaultcollection/myproject/_git/myrepository", + @"ssh://tfs.myserver/", "defaultcollection", @"https://tfs.myserver/defaultcollection", "myproject", "myrepository")] [InlineData( @"ssh://mytenant.visualstudio.com/defaultcollection/myproject/_git/myrepository", + @"ssh://mytenant.visualstudio.com/", "defaultcollection", @"https://mytenant.visualstudio.com/defaultcollection", "myproject", "myrepository")] [InlineData( @"ssh://mytenant.visualstudio.com/defaultcollection/myproject/_git/myrepository/somethingelse", + @"ssh://mytenant.visualstudio.com/", "defaultcollection", @"https://mytenant.visualstudio.com/defaultcollection", "myproject", "myrepository")] [InlineData( @"ssh://tfs.foo.com/foo/foo/_git/foo", + @"ssh://tfs.foo.com/", "foo", @"https://tfs.foo.com/foo", "foo", "foo")] [InlineData( @"ssh://foo:bar@myserver:8080/tfs/defaultcollection/myproject/_git/myrepository", + @"ssh://myserver:8080/", "defaultcollection", @"https://myserver:8080/tfs/defaultcollection", "myproject", "myrepository")] - public void Should_Parse_Repo_Url(string repoUrl, string collectionName, string collectionurl, string projectName, string repositoryName) + public void Should_Parse_Repo_Url(string repoUrl, string serverUrl, string collectionName, string collectionurl, string projectName, string repositoryName) { // Given / When var repositoryDescription = new RepositoryDescription(new Uri(repoUrl)); // Then + repositoryDescription.ServerUrl.ToString().ShouldBe(serverUrl); repositoryDescription.CollectionName.ShouldBe(collectionName); repositoryDescription.CollectionUrl.ShouldBe(new Uri(collectionurl)); repositoryDescription.ProjectName.ShouldBe(projectName); diff --git a/src/TfsUrlParser.Tests/TfsUrlParser.Tests.csproj b/src/TfsUrlParser.Tests/TfsUrlParser.Tests.csproj index d952462..a2e70c5 100644 --- a/src/TfsUrlParser.Tests/TfsUrlParser.Tests.csproj +++ b/src/TfsUrlParser.Tests/TfsUrlParser.Tests.csproj @@ -35,8 +35,8 @@ ..\TfsUrlParser.Tests.ruleset - - ..\packages\Shouldly.2.8.2\lib\net451\Shouldly.dll + + ..\packages\Shouldly.2.8.3\lib\net451\Shouldly.dll True diff --git a/src/TfsUrlParser.Tests/packages.config b/src/TfsUrlParser.Tests/packages.config index f4f0246..5bf3437 100644 --- a/src/TfsUrlParser.Tests/packages.config +++ b/src/TfsUrlParser.Tests/packages.config @@ -1,6 +1,6 @@  - + diff --git a/src/TfsUrlParser/RepositoryDescription.cs b/src/TfsUrlParser/RepositoryDescription.cs index 30edf99..963fb74 100644 --- a/src/TfsUrlParser/RepositoryDescription.cs +++ b/src/TfsUrlParser/RepositoryDescription.cs @@ -38,6 +38,7 @@ public RepositoryDescription(Uri repoUrl) var splitLastPart = splitPath[1].Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + this.ServerUrl = new Uri(repoUrl.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped)); this.CollectionName = splitFirstPart.Reverse().Skip(1).Take(1).Single(); this.CollectionUrl = new Uri( @@ -48,6 +49,11 @@ public RepositoryDescription(Uri repoUrl) this.RepositoryName = splitLastPart.First(); } + /// + /// Gets the Url of the Team Foundation Server. + /// + public Uri ServerUrl { get; } + /// /// Gets the name of the Team Foundation Server collection. /// diff --git a/src/TfsUrlParser/TfsUrlParser.csproj b/src/TfsUrlParser/TfsUrlParser.csproj index 2b6ff79..794be0f 100644 --- a/src/TfsUrlParser/TfsUrlParser.csproj +++ b/src/TfsUrlParser/TfsUrlParser.csproj @@ -1,7 +1,5 @@  - - Debug @@ -52,31 +50,25 @@ - + + Designer + - - - - - - - - - + + + + + + + + - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - -