Merge pull request #77 from dwijnand/ssh-based-repo-apis

Recover lost ssh-based repo API
This commit is contained in:
eugene yokota 2017-03-31 10:20:48 -07:00 committed by GitHub
commit 9cf41bbf36
2 changed files with 45 additions and 0 deletions

View File

@ -524,6 +524,7 @@
"target": "Scala",
"type": "interface",
"doc": "sbt interface for an Ivy ssh-based repository (ssh and sftp). Requires the Jsch library..",
"parents": "sbt.librarymanagement.SshBasedRepositoryExtra",
"fields": [
{ "name": "connection", "type": "sbt.librarymanagement.SshConnection" }
],
@ -534,6 +535,7 @@
"target": "Scala",
"type": "record",
"doc": "sbt interface for an Ivy repository over ssh. More convenient construction is done using Resolver.ssh.",
"parents": "sbt.librarymanagement.SshRepositoryExtra",
"fields": [
{ "name": "publishPermissions", "type": "String?" }
],
@ -552,6 +554,7 @@
"target": "Scala",
"type": "record",
"doc": "sbt interface for an Ivy repository over sftp. More convenient construction is done using Resolver.sftp.",
"parents": "sbt.librarymanagement.SftpRepositoryExtra",
"extra": [
"def this(name: String, connection: sbt.librarymanagement.SshConnection, patterns: sbt.librarymanagement.Patterns) = ",
" this(name, patterns, connection)"

View File

@ -41,6 +41,48 @@ abstract class PatternsFunctions {
}
}
trait SshBasedRepositoryExtra {
/** The object representing the configured ssh connection for this repository. */
def connection: SshConnection
type RepositoryType <: SshBasedRepository
protected def copy(connection: SshConnection): RepositoryType
private def copy(authentication: SshAuthentication): RepositoryType =
copy(connection withAuthentication authentication)
/** Configures this to use the specified user name and password when connecting to the remote repository. */
def as(user: String, password: String): RepositoryType = as(user, Some(password))
def as(user: String): RepositoryType = as(user, None)
def as(user: String, password: Option[String]): RepositoryType = copy(PasswordAuthentication(user, password))
/** Configures this to use the specified keyfile and password for the keyfile when connecting to the remote repository. */
def as(user: String, keyfile: File): RepositoryType = as(user, keyfile, None)
def as(user: String, keyfile: File, password: String): RepositoryType = as(user, keyfile, Some(password))
def as(user: String, keyfile: File, password: Option[String]): RepositoryType =
copy(KeyFileAuthentication(user, keyfile, password))
}
trait SshRepositoryExtra extends SshBasedRepositoryExtra {
def name: String
def patterns: sbt.librarymanagement.Patterns
def publishPermissions: Option[String]
type RepositoryType = SshRepository
protected def copy(connection: SshConnection): SshRepository =
SshRepository(name, connection, patterns, publishPermissions)
}
trait SftpRepositoryExtra extends SshBasedRepositoryExtra {
def name: String
def patterns: sbt.librarymanagement.Patterns
type RepositoryType = SftpRepository
protected def copy(connection: SshConnection): SftpRepository = SftpRepository(name, connection, patterns)
}
/** A repository that conforms to sbt launcher's interface */
private[sbt] class FakeRepository(resolver: DependencyResolver) extends xsbti.Repository {
def rawRepository = new RawRepository(resolver)