Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
Krystian Panek committed Mar 11, 2020
1 parent 36a9aa0 commit 8ae9058
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ interface Runtime {

val hostInternalIp: String

val hostInternalIpMissing: Boolean

fun determinePath(path: String): String

fun determinePath(file: File) = determinePath(file.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ package com.cognifide.gradle.environment.docker.runtime
import com.cognifide.gradle.environment.EnvironmentExtension
import com.cognifide.gradle.environment.docker.DockerProcess
import com.cognifide.gradle.environment.docker.Runtime
import org.gradle.internal.os.OperatingSystem

abstract class Base(protected val environment: EnvironmentExtension) : Runtime {

protected val logger = environment.project.logger

override fun toString(): String = name.toLowerCase()

@Suppress("SpreadOperator", "TooGenericExceptionCaught")
protected fun detectHostInternalIp(): String? = try {
DockerProcess.execString {
Expand All @@ -20,4 +19,8 @@ abstract class Base(protected val environment: EnvironmentExtension) : Runtime {
logger.debug("Cannot detect Docker host internal IP. Cause: ${e.message}", e)
null
}

override val hostInternalIpMissing: Boolean get() = !(OperatingSystem.current().isWindows || OperatingSystem.current().isMacOsX)

override fun toString(): String = name.toLowerCase()
}

0 comments on commit 8ae9058

Please sign in to comment.