Skip to content

Commit

Permalink
we don't want snapshots. fixes #61
Browse files Browse the repository at this point in the history
  • Loading branch information
softprops committed Jun 12, 2012
1 parent de76bcb commit 63a298a
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions plugin/src/main/scala/ls.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ object Plugin extends sbt.Plugin
parseJson[Library](json)
}
out.log.debug("Valid version info")
if (snapshot(vinfo.version)) out.log.warn(SnapshotWarning)
true
} catch {
case e =>
Expand All @@ -88,15 +89,19 @@ object Plugin extends sbt.Plugin
(out, maybeUser, maybeRepo, branch, vers, host, vfile, lint) =>
(maybeUser, maybeRepo) match {
case (Some(user), Some(repo)) =>
if(lint) {
out.log.info("lsyncing project %s/%s@%s..." format(user, repo, vers))
try {
// todo: should this by an async server request?
http(Client(host).lsync(user, repo, branch.getOrElse("master"), vers) as_str)
out.log.info("Project was synchronized")
} catch {
case e =>
out.log.warn("Error synchronizing project libraries %s" format e.getMessage)
if (lint) {
if (snapshot(vers)) {
out.log.warn(SnapshotWarning)
} else {
out.log.info("lsyncing project %s/%s@%s..." format(user, repo, vers))
try {
// todo: should this by an async server request?
http(Client(host).lsync(user, repo, branch.getOrElse("master"), vers) as_str)
out.log.info("Project was synchronized")
} catch {
case e =>
out.log.warn("Error synchronizing project libraries %s" format e.getMessage)
}
}
} else sys.error("Your version descriptor was invalid. %s" format(
IO.read(vfile)
Expand All @@ -105,6 +110,10 @@ object Plugin extends sbt.Plugin
}
}

private def snapshot(vstr: String) = vstr.toUpperCase.endsWith("SNAPSHOT")

private val SnapshotWarning = "ls only supports release versions not likely to change. This excludes snapshot versions."

private def writeVersionTask: Initialize[Task[Unit]] =
(streams, versionFile, versionInfo, skipWrite) map {
(out, f, info, skip) =>
Expand Down

0 comments on commit 63a298a

Please sign in to comment.