(refs #115)Add new method to get sshUrl to RepositoryInfo

This commit is contained in:
takezoe
2014-03-13 22:26:15 +09:00
parent 02d79cb16a
commit 70192ce420
6 changed files with 16 additions and 13 deletions

View File

@@ -288,10 +288,14 @@ trait RepositoryService { self: AccountService =>
object RepositoryService {
case class RepositoryInfo(owner: String, name: String, url: String, repository: Repository,
case class RepositoryInfo(owner: String, name: String, httpUrl: String, repository: Repository,
issueCount: Int, pullCount: Int, commitCount: Int, forkedCount: Int,
branchList: Seq[String], tags: Seq[util.JGitUtil.TagInfo], managers: Seq[String]){
lazy val host = """^https?://(.+?)(:\d+)?/""".r.findFirstMatchIn(httpUrl).get.group(1)
def sshUrl(port: Int) = s"ssh://${host}:${port}/${owner}/${name}.git"
/**
* Creates instance with issue count and pull request count.
*/