Skip to content

Commit

Permalink
fix credentials for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
harrah committed Dec 31, 2012
1 parent 21fc872 commit b9a4526
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions project/Release.scala
Expand Up @@ -17,15 +17,19 @@ object Release extends Build
lazy val pushWiki = TaskKey[Unit]("push-wiki")
lazy val pushMain = TaskKey[Unit]("push-main")

val PublishRepoHost = "typesafe.artifactoryonline.com"

def settings(nonRoots: => Seq[ProjectReference], launcher: ScopedTask[File]): Seq[Setting[_]] =
(if(CredentialsFile.exists) releaseSettings(nonRoots, launcher) else Nil) ++
(if(file(".release.sbt") exists) fullReleaseSettings else Nil)
if(CredentialsFile.exists)
releaseSettings(nonRoots, launcher) /* ++ fullReleaseSettings */
else
Nil

def releaseSettings(nonRoots: => Seq[ProjectReference], launcher: ScopedTask[File]): Seq[Setting[_]] = Seq(
publishTo in ThisBuild <<= publishResolver,
remoteID <<= publishStatus("typesafe-ivy-" + _),
credentials in Global += Credentials(CredentialsFile),
remoteBase <<= publishStatus( "https://typesafe.artifactoryonline.com/typesafe/ivy-" + _ ),
credentials in ThisBuild += Credentials(CredentialsFile),
remoteBase <<= publishStatus( "https://" + PublishRepoHost + "/typesafe/ivy-" + _ ),
publishAllArtifacts <<= Util.inAll(nonRoots, publish.task),
publishLauncher <<= deployLauncher(launcher),
publishRelease <<= Seq(publishLauncher, publishAllArtifacts).dependOn,
Expand All @@ -45,8 +49,10 @@ object Release extends Build
}
def getCredentials(cs: Seq[Credentials], log: Logger): (String, String) =
{
val Some(creds) = Credentials.forHost(cs, "typesafe.artifactoryonline.com")
(creds.userName, creds.passwd)
Credentials.forHost(cs, PublishRepoHost) match {
case Some(creds) => (creds.userName, creds.passwd)
case None => error("No credentials defined for " + PublishRepoHost)
}
}
def snapshotPattern(version: String) = Resolver.localBasePattern.replaceAll("""\[revision\]""", version)
def publishResolver: Project.Initialize[Option[Resolver]] = (remoteID, remoteBase) { (id, base) =>
Expand Down

0 comments on commit b9a4526

Please sign in to comment.