Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if the all team exists, and if not create one #14

Merged
merged 1 commit into from
Apr 9, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/lib/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import scala.util.{Success, Try}
import com.github.nscala_time.time.Imports._
import scala.concurrent._
import ExecutionContext.Implicits.global
import org.kohsuke.github.GHOrganization.Permission

object Implicits {
implicit class RichFuture[S](f: Future[S]) {
Expand All @@ -31,7 +32,7 @@ object Implicits {

lazy val allTeamOpt = teamsByName.get("all")

lazy val allTeam = allTeamOpt.getOrElse(throw new IllegalStateException("Missing 'all' team - GU-Who needs the 'all' team to operate"))
lazy val allTeam = allTeamOpt.getOrElse(createAllTeam)

lazy val botsTeamOpt = teamsByName.get("bots")

Expand All @@ -42,6 +43,12 @@ object Implicits {
orgMember
}
}

def createAllTeam: GHTeam = {
val team = org.createTeam("all", Permission.PULL)
team.add(peopleRepo)
team
}
}

implicit class RichTeam(team: GHTeam) {
Expand Down