-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace dockerVersion with dockerApiVersion (#1296)
* Add dockerApiVersion validation * Fix typo * Move `dockerApiVersion` to `DockerKeysEx` * Restore previous methods as deprecated for compatibility issues * Update docs * Set `sbtApiVersion` for integration test
- Loading branch information
Showing
8 changed files
with
77 additions
and
19 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
src/main/scala/com/typesafe/sbt/packager/docker/DockerApiVersion.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.typesafe.sbt.packager.docker | ||
|
||
import scala.util.matching.Regex | ||
|
||
case class DockerApiVersion(major: Int, minor: Int) | ||
|
||
object DockerApiVersion { | ||
private val DockerApiVersionPattern: Regex = """^'?([0-9]+)\.([0-9]+)'?$""".r | ||
|
||
def parse(version: String): Option[DockerApiVersion] = | ||
Option(version).collect { | ||
case DockerApiVersionPattern(major, minor) => new DockerApiVersion(major.toInt, minor.toInt) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import com.typesafe.sbt.packager.docker._ | ||
|
||
dockerVersion := Some(DockerVersion(1, 13, 0, None)) | ||
dockerApiVersion := Some(DockerApiVersion(1, 28)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/test/scala/com/typesafe/sbt/packager/docker/DockerApiVersionSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.typesafe.sbt.packager.docker | ||
|
||
import org.scalatest._ | ||
|
||
class DockerApiVersionSpec extends FlatSpec with DiagrammedAssertions { | ||
"DockerApiVersion" should "parse 1.40" in { | ||
val v = DockerApiVersion.parse("1.40") | ||
assert(v == Some(DockerApiVersion(1, 40))) | ||
} | ||
} |