Welcome to mirror list, hosted at ThFree Co, Russian Federation.

package.scala « util « github « rorschach « getbootstrap « com « scala « main « src - github.com/twbs/rorschach.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 43db97c9648758a1bbbecc942a8e427ec96d5a70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.getbootstrap.rorschach.github

import org.eclipse.egit.github.core._

package object util {
  implicit class RichRepository(repo: Repository) {
    def repositoryId: RepositoryId = new RepositoryId(repo.getOwner.getLogin, repo.getName)
  }
  implicit class RichPullRequestMarker(marker: PullRequestMarker) {
    def commitSha: CommitSha = new CommitSha(marker.getSha)
  }
  implicit class RichCommitFile(file: CommitFile) {
    def status: CommitFileStatus = CommitFileStatus(file.getStatus)
  }
  implicit class RichPullRequest(pr: PullRequest) {
    def number: PullRequestNumber = PullRequestNumber(pr.getNumber).get

    def status_= (value: PullRequestStatus) {
      pr.setState(value.Value)
    }
    def status = PullRequestStatus(pr.getState)
  }
  implicit class RichCommitFileSeq(files: Seq[CommitFile]) {
    def filenames: Set[String] = files.map{ _.getFilename }.toSet[String]
  }
}