From dff97b40df39e5eb391e1fc30ca47180384f1747 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Sat, 18 Mar 2017 01:58:01 -0400 Subject: Refactor trait-based dependencies to constructor parameters --- .../src/main/scala/io/crashbox/ci/Git.scala | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 crashbox-server/src/main/scala/io/crashbox/ci/Git.scala (limited to 'crashbox-server/src/main/scala/io/crashbox/ci/Git.scala') diff --git a/crashbox-server/src/main/scala/io/crashbox/ci/Git.scala b/crashbox-server/src/main/scala/io/crashbox/ci/Git.scala new file mode 100644 index 0000000..db39891 --- /dev/null +++ b/crashbox-server/src/main/scala/io/crashbox/ci/Git.scala @@ -0,0 +1,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) + } + +} -- cgit v1.2.3