summaryrefslogtreecommitdiff
path: root/crashbox-server/src/main/scala/io/crashbox/ci/Source.scala
blob: 335e59c97c445e54704c87d23f035b96bc75dadb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package io.crashbox.ci

import java.io.File
import java.net.URL
import org.eclipse.jgit.api.Git
import scala.concurrent.Future

trait Source { self: Core =>

  def fetchSource(from: URL, to: File): Future[File] =
    Future {
      log.debug(s"Cloning git repo from $from to $to")
      Git.cloneRepository.setURI(from.toURI.toString).setDirectory(to).call()
      to
    }(blockingDispatcher)

}