File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
lib/jekyll-github-metadata Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -61,9 +61,14 @@ def git_remote_url
6161
6262 def nwo_from_git_origin_remote
6363 return unless Jekyll . env == "development" || Jekyll . env == "test"
64- matches = git_remote_url . chomp ( ".git" ) . match %r!github.com(:|/)([ \w -]+)/([ \w \. -]+)!
64+ matches = git_remote_url . chomp ( ".git" ) . match github_remote_regex
6565 matches [ 2 ..3 ] . join ( "/" ) if matches
6666 end
67+
68+ def github_remote_regex
69+ github_host_regex = Regexp . escape ( Jekyll ::GitHubMetadata ::Pages . github_hostname )
70+ %r!#{ github_host_regex } (:|/)([\w -]+)/([\w \. -]+)!
71+ end
6772 end
6873 end
6974end
Original file line number Diff line number Diff line change 7676 expect ( subject . send ( :nwo_from_git_origin_remote ) ) . to include ( "afeld/hackerhours.org" )
7777 end
7878
79+ it "handles private github instance addresses" do
80+ allow ( Jekyll ::GitHubMetadata ::Pages ) . to receive ( :github_hostname ) . and_return "github.myorg.com"
81+ allow ( subject ) . to receive ( :git_remote_url ) . and_return <<-EOS
82+ origin https://github.myorg.com/myorg/myrepo.git (fetch)
83+ origin https://github.myorg.com/myorg/myrepo.git (push)
84+ EOS
85+ expect ( subject . send ( :nwo_from_git_origin_remote ) ) . to include ( "myorg/myrepo" )
86+ end
87+
7988 context "when git doesn't exist" do
8089 before ( :each ) do
8190 @old_path = ENV [ "PATH" ]
You can’t perform that action at this time.
0 commit comments