{"action":"created","comment":{"url":"https://api.github.com/repos/Carthage/Carthage/pulls/comments/36589521","id":36589521,"diff_hunk":"@@ -64,55 +64,144 @@ extension GitHubError: Decodable {\n \t}\n }\n \n-/// Describes a GitHub.com repository.\n+/// Describes a GitHub.com or GitHub Enterprise repository.\n public struct GitHubRepository: Equatable {\n+\n+\t/// Represents a GitHub server instance.\n+\tpublic enum Server: Equatable, Hashable, Printable {\n+\t\t/// The github.com server instance.\n+\t\tcase GitHub\n+\n+\t\t/// An Enterprise instance with its hostname.\n+\t\tcase Enterprise(scheme: String, hostname: String)\n+\n+\t\tpublic var scheme: String {\n+\t\t\tswitch self {\n+\t\t\tcase .GitHub:\n+\t\t\t\treturn \"https\"\n+\n+\t\t\tcase let .Enterprise(scheme, _):\n+\t\t\t\treturn scheme\n+\t\t\t}\n+\t\t}\n+\n+\t\tpublic var hostname: String {\n+\t\t\tswitch self {\n+\t\t\tcase .GitHub:\n+\t\t\t\treturn \"github.com\"\n+\n+\t\t\tcase let .Enterprise(_, hostname):\n+\t\t\t\treturn hostname\n+\t\t\t}\n+\t\t}\n+\n+\t\tpublic var APIEndpoint: String {\n+\t\t\tswitch self {\n+\t\t\tcase .GitHub:\n+\t\t\t\treturn \"\\(scheme)://api.\\(hostname)\"\n+\n+\t\t\tcase .Enterprise:\n+\t\t\t\treturn \"\\(description)/api/v3\"\n+\t\t\t}\n+\t\t}\n+\n+\t\tpublic var hashValue: Int {\n+\t\t\treturn scheme.hashValue ^ hostname.hashValue\n+\t\t}\n+\n+\t\tpublic var description: String {\n+\t\t\treturn \"\\(scheme)://\\(hostname)\"\n+\t\t}\n+\t}\n+\n+\tpublic let server: Server\n \tpublic let owner: String\n \tpublic let name: String\n \n \t/// The URL that should be used for cloning this repository over HTTPS.\n \tpublic var HTTPSURL: GitURL {\n-\t\treturn GitURL(\"https://github.com/\\(owner)/\\(name).git\")\n+\t\treturn GitURL(\"\\(server)/\\(owner)/\\(name).git\")\n \t}\n \n \t/// The URL that should be used for cloning this repository over SSH.\n \tpublic var SSHURL: GitURL {\n-\t\treturn GitURL(\"ssh://git@github.com/\\(owner)/\\(name).git\")\n+\t\treturn GitURL(\"ssh://git@\\(server.hostname)/\\(owner)/\\(name).git\")\n \t}\n \n \t/// The URL for filing a new GitHub issue for this repository.\n \tpublic var newIssueURL: NSURL {\n-\t\treturn NSURL(string: \"https://github.com/\\(owner)/\\(name)/issues/new\")!\n+\t\treturn NSURL(string: \"\\(server)/\\(owner)/\\(name)/issues/new\")!\n \t}\n \n-\tpublic init(owner: String, name: String) {\n+\tpublic init(server: Server = .GitHub, owner: String, name: String) {\n+\t\tself.server = server\n \t\tself.owner = owner\n \t\tself.name = name\n \t}\n \n-\t/// Parses repository information out of a string of the form \"owner/name\".\n-\tpublic static func fromNWO(NWO: String) -> Result<GitHubRepository, CarthageError> {\n-\t\tlet components = split(NWO, maxSplit: 1, allowEmptySlices: false) { $0 == \"/\" }\n-\t\tif components.count < 2 {\n-\t\t\treturn .failure(CarthageError.ParseError(description: \"invalid GitHub repository name \\\"\\(NWO)\\\"\"))\n+\t/// Parses repository information out of a string of the form \"owner/name\"\n+\t/// for the github.com, or the form \"http(s)://hostname/owner/name\" for\n+\t/// Enterprise instances.\n+\tpublic static func fromIdentifier(identifier: String) -> Result<GitHubRepository, CarthageError> {\n+\t\t// GitHub.com\n+\t\tlet components = split(identifier, maxSplit: 1, allowEmptySlices: false) { $0 == \"/\" }\n+\t\tif components.count == 2 && !components[0].hasPrefix(\"http\") {","path":"Source/CarthageKit/GitHub.swift","position":95,"original_position":95,"commit_id":"576d34a37ed5f64d256f00e5a7063e19baf5688f","original_commit_id":"576d34a37ed5f64d256f00e5a7063e19baf5688f","user":{"login":"mdiep","id":1302,"avatar_url":"https://avatars.githubusercontent.com/u/1302?v=3","gravatar_id":"","url":"https://api.github.com/users/mdiep","html_url":"https://github.com/mdiep","followers_url":"https://api.github.com/users/mdiep/followers","following_url":"https://api.github.com/users/mdiep/following{/other_user}","gists_url":"https://api.github.com/users/mdiep/gists{/gist_id}","starred_url":"https://api.github.com/users/mdiep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdiep/subscriptions","organizations_url":"https://api.github.com/users/mdiep/orgs","repos_url":"https://api.github.com/users/mdiep/repos","events_url":"https://api.github.com/users/mdiep/events{/privacy}","received_events_url":"https://api.github.com/users/mdiep/received_events","type":"User","site_admin":true},"body":"You could use a regular expression to check for `^(\\w+)/(\\w+)$`—or code that checks for the equivalent.","created_at":"2015-08-09T15:35:54Z","updated_at":"2015-08-09T15:35:54Z","html_url":"https://github.com/Carthage/Carthage/pull/657#discussion_r36589521","pull_request_url":"https://api.github.com/repos/Carthage/Carthage/pulls/657","_links":{"self":{"href":"https://api.github.com/repos/Carthage/Carthage/pulls/comments/36589521"},"html":{"href":"https://github.com/Carthage/Carthage/pull/657#discussion_r36589521"},"pull_request":{"href":"https://api.github.com/repos/Carthage/Carthage/pulls/657"}}},"pull_request":{"url":"https://api.github.com/repos/Carthage/Carthage/pulls/657","id":41659880,"html_url":"https://github.com/Carthage/Carthage/pull/657","diff_url":"https://github.com/Carthage/Carthage/pull/657.diff","patch_url":"https://github.com/Carthage/Carthage/pull/657.patch","issue_url":"https://api.github.com/repos/Carthage/Carthage/issues/657","number":657,"state":"open","locked":false,"title":"[WIP] Add support for GitHub Enterprise","user":{"login":"ikesyo","id":909674,"avatar_url":"https://avatars.githubusercontent.com/u/909674?v=3","gravatar_id":"","url":"https://api.github.com/users/ikesyo","html_url":"https://github.com/ikesyo","followers_url":"https://api.github.com/users/ikesyo/followers","following_url":"https://api.github.com/users/ikesyo/following{/other_user}","gists_url":"https://api.github.com/users/ikesyo/gists{/gist_id}","starred_url":"https://api.github.com/users/ikesyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikesyo/subscriptions","organizations_url":"https://api.github.com/users/ikesyo/orgs","repos_url":"https://api.github.com/users/ikesyo/repos","events_url":"https://api.github.com/users/ikesyo/events{/privacy}","received_events_url":"https://api.github.com/users/ikesyo/received_events","type":"User","site_admin":false},"body":"Resolves #319.","created_at":"2015-08-05T09:35:22Z","updated_at":"2015-08-09T15:35:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c18eb2f608a1fb6b6a5916b5f86ef27c41dbf2d1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Carthage/Carthage/pulls/657/commits","review_comments_url":"https://api.github.com/repos/Carthage/Carthage/pulls/657/comments","review_comment_url":"https://api.github.com/repos/Carthage/Carthage/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Carthage/Carthage/issues/657/comments","statuses_url":"https://api.github.com/repos/Carthage/Carthage/statuses/576d34a37ed5f64d256f00e5a7063e19baf5688f","head":{"label":"Carthage:github-enterprise","ref":"github-enterprise","sha":"576d34a37ed5f64d256f00e5a7063e19baf5688f","user":{"login":"Carthage","id":9146792,"avatar_url":"https://avatars.githubusercontent.com/u/9146792?v=3","gravatar_id":"","url":"https://api.github.com/users/Carthage","html_url":"https://github.com/Carthage","followers_url":"https://api.github.com/users/Carthage/followers","following_url":"https://api.github.com/users/Carthage/following{/other_user}","gists_url":"https://api.github.com/users/Carthage/gists{/gist_id}","starred_url":"https://api.github.com/users/Carthage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Carthage/subscriptions","organizations_url":"https://api.github.com/users/Carthage/orgs","repos_url":"https://api.github.com/users/Carthage/repos","events_url":"https://api.github.com/users/Carthage/events{/privacy}","received_events_url":"https://api.github.com/users/Carthage/received_events","type":"Organization","site_admin":false},"repo":{"id":25050844,"name":"Carthage","full_name":"Carthage/Carthage","owner":{"login":"Carthage","id":9146792,"avatar_url":"https://avatars.githubusercontent.com/u/9146792?v=3","gravatar_id":"","url":"https://api.github.com/users/Carthage","html_url":"https://github.com/Carthage","followers_url":"https://api.github.com/users/Carthage/followers","following_url":"https://api.github.com/users/Carthage/following{/other_user}","gists_url":"https://api.github.com/users/Carthage/gists{/gist_id}","starred_url":"https://api.github.com/users/Carthage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Carthage/subscriptions","organizations_url":"https://api.github.com/users/Carthage/orgs","repos_url":"https://api.github.com/users/Carthage/repos","events_url":"https://api.github.com/users/Carthage/events{/privacy}","received_events_url":"https://api.github.com/users/Carthage/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Carthage/Carthage","description":"A simple, decentralized dependency manager for Cocoa","fork":false,"url":"https://api.github.com/repos/Carthage/Carthage","forks_url":"https://api.github.com/repos/Carthage/Carthage/forks","keys_url":"https://api.github.com/repos/Carthage/Carthage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Carthage/Carthage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Carthage/Carthage/teams","hooks_url":"https://api.github.com/repos/Carthage/Carthage/hooks","issue_events_url":"https://api.github.com/repos/Carthage/Carthage/issues/events{/number}","events_url":"https://api.github.com/repos/Carthage/Carthage/events","assignees_url":"https://api.github.com/repos/Carthage/Carthage/assignees{/user}","branches_url":"https://api.github.com/repos/Carthage/Carthage/branches{/branch}","tags_url":"https://api.github.com/repos/Carthage/Carthage/tags","blobs_url":"https://api.github.com/repos/Carthage/Carthage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Carthage/Carthage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Carthage/Carthage/git/refs{/sha}","trees_url":"https://api.github.com/repos/Carthage/Carthage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Carthage/Carthage/statuses/{sha}","languages_url":"https://api.github.com/repos/Carthage/Carthage/languages","stargazers_url":"https://api.github.com/repos/Carthage/Carthage/stargazers","contributors_url":"https://api.github.com/repos/Carthage/Carthage/contributors","subscribers_url":"https://api.github.com/repos/Carthage/Carthage/subscribers","subscription_url":"https://api.github.com/repos/Carthage/Carthage/subscription","commits_url":"https://api.github.com/repos/Carthage/Carthage/commits{/sha}","git_commits_url":"https://api.github.com/repos/Carthage/Carthage/git/commits{/sha}","comments_url":"https://api.github.com/repos/Carthage/Carthage/comments{/number}","issue_comment_url":"https://api.github.com/repos/Carthage/Carthage/issues/comments{/number}","contents_url":"https://api.github.com/repos/Carthage/Carthage/contents/{+path}","compare_url":"https://api.github.com/repos/Carthage/Carthage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Carthage/Carthage/merges","archive_url":"https://api.github.com/repos/Carthage/Carthage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Carthage/Carthage/downloads","issues_url":"https://api.github.com/repos/Carthage/Carthage/issues{/number}","pulls_url":"https://api.github.com/repos/Carthage/Carthage/pulls{/number}","milestones_url":"https://api.github.com/repos/Carthage/Carthage/milestones{/number}","notifications_url":"https://api.github.com/repos/Carthage/Carthage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Carthage/Carthage/labels{/name}","releases_url":"https://api.github.com/repos/Carthage/Carthage/releases{/id}","created_at":"2014-10-10T19:54:55Z","updated_at":"2015-08-09T14:32:53Z","pushed_at":"2015-08-09T15:19:51Z","git_url":"git://github.com/Carthage/Carthage.git","ssh_url":"git@github.com:Carthage/Carthage.git","clone_url":"https://github.com/Carthage/Carthage.git","svn_url":"https://github.com/Carthage/Carthage","homepage":"","size":14039,"stargazers_count":4091,"watchers_count":4091,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":199,"mirror_url":null,"open_issues_count":95,"forks":199,"open_issues":95,"watchers":4091,"default_branch":"master"}},"base":{"label":"Carthage:master","ref":"master","sha":"02beeac93acd70a0634f665194f705bd9006d3d8","user":{"login":"Carthage","id":9146792,"avatar_url":"https://avatars.githubusercontent.com/u/9146792?v=3","gravatar_id":"","url":"https://api.github.com/users/Carthage","html_url":"https://github.com/Carthage","followers_url":"https://api.github.com/users/Carthage/followers","following_url":"https://api.github.com/users/Carthage/following{/other_user}","gists_url":"https://api.github.com/users/Carthage/gists{/gist_id}","starred_url":"https://api.github.com/users/Carthage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Carthage/subscriptions","organizations_url":"https://api.github.com/users/Carthage/orgs","repos_url":"https://api.github.com/users/Carthage/repos","events_url":"https://api.github.com/users/Carthage/events{/privacy}","received_events_url":"https://api.github.com/users/Carthage/received_events","type":"Organization","site_admin":false},"repo":{"id":25050844,"name":"Carthage","full_name":"Carthage/Carthage","owner":{"login":"Carthage","id":9146792,"avatar_url":"https://avatars.githubusercontent.com/u/9146792?v=3","gravatar_id":"","url":"https://api.github.com/users/Carthage","html_url":"https://github.com/Carthage","followers_url":"https://api.github.com/users/Carthage/followers","following_url":"https://api.github.com/users/Carthage/following{/other_user}","gists_url":"https://api.github.com/users/Carthage/gists{/gist_id}","starred_url":"https://api.github.com/users/Carthage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Carthage/subscriptions","organizations_url":"https://api.github.com/users/Carthage/orgs","repos_url":"https://api.github.com/users/Carthage/repos","events_url":"https://api.github.com/users/Carthage/events{/privacy}","received_events_url":"https://api.github.com/users/Carthage/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Carthage/Carthage","description":"A simple, decentralized dependency manager for Cocoa","fork":false,"url":"https://api.github.com/repos/Carthage/Carthage","forks_url":"https://api.github.com/repos/Carthage/Carthage/forks","keys_url":"https://api.github.com/repos/Carthage/Carthage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Carthage/Carthage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Carthage/Carthage/teams","hooks_url":"https://api.github.com/repos/Carthage/Carthage/hooks","issue_events_url":"https://api.github.com/repos/Carthage/Carthage/issues/events{/number}","events_url":"https://api.github.com/repos/Carthage/Carthage/events","assignees_url":"https://api.github.com/repos/Carthage/Carthage/assignees{/user}","branches_url":"https://api.github.com/repos/Carthage/Carthage/branches{/branch}","tags_url":"https://api.github.com/repos/Carthage/Carthage/tags","blobs_url":"https://api.github.com/repos/Carthage/Carthage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Carthage/Carthage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Carthage/Carthage/git/refs{/sha}","trees_url":"https://api.github.com/repos/Carthage/Carthage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Carthage/Carthage/statuses/{sha}","languages_url":"https://api.github.com/repos/Carthage/Carthage/languages","stargazers_url":"https://api.github.com/repos/Carthage/Carthage/stargazers","contributors_url":"https://api.github.com/repos/Carthage/Carthage/contributors","subscribers_url":"https://api.github.com/repos/Carthage/Carthage/subscribers","subscription_url":"https://api.github.com/repos/Carthage/Carthage/subscription","commits_url":"https://api.github.com/repos/Carthage/Carthage/commits{/sha}","git_commits_url":"https://api.github.com/repos/Carthage/Carthage/git/commits{/sha}","comments_url":"https://api.github.com/repos/Carthage/Carthage/comments{/number}","issue_comment_url":"https://api.github.com/repos/Carthage/Carthage/issues/comments{/number}","contents_url":"https://api.github.com/repos/Carthage/Carthage/contents/{+path}","compare_url":"https://api.github.com/repos/Carthage/Carthage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Carthage/Carthage/merges","archive_url":"https://api.github.com/repos/Carthage/Carthage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Carthage/Carthage/downloads","issues_url":"https://api.github.com/repos/Carthage/Carthage/issues{/number}","pulls_url":"https://api.github.com/repos/Carthage/Carthage/pulls{/number}","milestones_url":"https://api.github.com/repos/Carthage/Carthage/milestones{/number}","notifications_url":"https://api.github.com/repos/Carthage/Carthage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Carthage/Carthage/labels{/name}","releases_url":"https://api.github.com/repos/Carthage/Carthage/releases{/id}","created_at":"2014-10-10T19:54:55Z","updated_at":"2015-08-09T14:32:53Z","pushed_at":"2015-08-09T15:19:51Z","git_url":"git://github.com/Carthage/Carthage.git","ssh_url":"git@github.com:Carthage/Carthage.git","clone_url":"https://github.com/Carthage/Carthage.git","svn_url":"https://github.com/Carthage/Carthage","homepage":"","size":14039,"stargazers_count":4091,"watchers_count":4091,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":199,"mirror_url":null,"open_issues_count":95,"forks":199,"open_issues":95,"watchers":4091,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Carthage/Carthage/pulls/657"},"html":{"href":"https://github.com/Carthage/Carthage/pull/657"},"issue":{"href":"https://api.github.com/repos/Carthage/Carthage/issues/657"},"comments":{"href":"https://api.github.com/repos/Carthage/Carthage/issues/657/comments"},"review_comments":{"href":"https://api.github.com/repos/Carthage/Carthage/pulls/657/comments"},"review_comment":{"href":"https://api.github.com/repos/Carthage/Carthage/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Carthage/Carthage/pulls/657/commits"},"statuses":{"href":"https://api.github.com/repos/Carthage/Carthage/statuses/576d34a37ed5f64d256f00e5a7063e19baf5688f"}}}}