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

import java.io.File
import java.net.URL

import scala.concurrent.Future

import org.eclipse.jgit.api.{Git => JGit}

object Git {

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

}