-
Notifications
You must be signed in to change notification settings - Fork 86
(#37) Add CustomRawUrlProvider to enable arbitrary content URLs #67
Conversation
Thanks! I will review as soon as I am back (thursday or friday). |
[TestFixture] | ||
public class TheInitialization | ||
{ | ||
[TestCase] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just create a single Test method and use test cases like this:
[TestCase("http://example.com/repo", true)]
[TestCase("gopher://example.com/repo", false)]
public void CorrectlyValidatesForUrls(string url, bool expectedValue)
{
// Test code here
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed like tests for other providers used explicit test case names for the positive and negative results so I kept that pattern. Let me know if you still like it changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was a mistake made by us. Please make the change, I will change the other tests after that.
From what I can see, this PR looks really good. I will verify with VS once I get home. |
A new CustomRawUrlProvider is added that acts as the final IProvider candidate. This provider interprets the TargetUrl parameter (`-u`) as the url to use for the RawGitUrl property of the provider. This enables supporting custom github/bitbucket content proxies as well as opens up an easy way to support conforming alternative git services without having to write a new IProvider implementation for each one.
|
||
GitLink.exe c:\source\catel -u https://raw.githubusercontent.com/catel/catel | ||
|
||
The custom url will be used to fill in the following pattern `{customUrl}/{revision}/{raltiveFilePath}` when generating the source mapping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raltiveFilePath => relativeFilePath
(#37) Add CustomRawUrlProvider to enable arbitrary content URLs
Very nice, this is much appreciated. |
The feature in this PR can be used to tackle a number of open scenarios:
{rootUrl}/{revision}/{relativeFilePath}
- as encoded in the inner workings of Linker.cs)The solution is to introduce a fallback provider that uses the
TargetUrl
parameter as the{rootUrl}
in that raw content access pattern. The usage would be as follows: