File tree Expand file tree Collapse file tree 4 files changed +15
-14
lines changed
main/kotlin/com/coder/gateway Expand file tree Collapse file tree 4 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ class CoderSettingsConfigurable : BoundConfigurable("Coder") {
2525 .comment(
2626 CoderGatewayBundle .message(
2727 " gateway.connector.settings.binary-source.comment" ,
28- CoderCLIManager (URL (" http://localhost" )).remoteBinaryURL.path,
28+ CoderCLIManager (URL (" http://localhost" ), CoderCLIManager .getDataDir() ).remoteBinaryURL.path,
2929 )
3030 )
3131 }
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import javax.xml.bind.annotation.adapters.HexBinaryAdapter
2525 */
2626class CoderCLIManager @JvmOverloads constructor(
2727 private val deploymentURL : URL ,
28- destinationDir : Path ? = null ,
28+ destinationDir : Path ,
2929 remoteBinaryURLOverride : String? = null ,
3030 private val sshConfigPath : Path = Path .of(System .getProperty("user.home")).resolve(".ssh/config"),
3131) {
@@ -49,11 +49,10 @@ class CoderCLIManager @JvmOverloads constructor(
4949 remoteBinaryURL.withPath(remoteBinaryURLOverride)
5050 }
5151 }
52- val dir = destinationDir ? : getDataDir()
5352 val host = getSafeHost(deploymentURL)
5453 val subdir = if (deploymentURL.port > 0 ) " ${host} -${deploymentURL.port} " else host
55- localBinaryPath = dir .resolve(subdir).resolve(binaryName).toAbsolutePath()
56- coderConfigPath = dir .resolve(subdir).resolve(" config" ).toAbsolutePath()
54+ localBinaryPath = destinationDir .resolve(subdir).resolve(binaryName).toAbsolutePath()
55+ coderConfigPath = destinationDir .resolve(subdir).resolve(" config" ).toAbsolutePath()
5756 }
5857
5958 /* *
Original file line number Diff line number Diff line change @@ -467,7 +467,8 @@ class CoderWorkspacesStepView(val setNextButtonEnabled: (Boolean) -> Unit) : Cod
467467 this .indicator.text = " Downloading Coder CLI..."
468468 val cliManager = CoderCLIManager (
469469 deploymentURL,
470- if (settings.binaryDestination.isNotBlank()) Path .of(settings.binaryDestination) else null ,
470+ if (settings.binaryDestination.isNotBlank()) Path .of(settings.binaryDestination)
471+ else CoderCLIManager .getDataDir(),
471472 settings.binarySource,
472473 )
473474 cliManager.downloadCLI()
@@ -722,7 +723,8 @@ class CoderWorkspacesStepView(val setNextButtonEnabled: (Boolean) -> Unit) : Cod
722723 logger.info(" Configuring Coder CLI..." )
723724 val cliManager = CoderCLIManager (
724725 wizardModel.coderURL.toURL(),
725- if (settings.binaryDestination.isNotBlank()) Path .of(settings.binaryDestination) else null ,
726+ if (settings.binaryDestination.isNotBlank()) Path .of(settings.binaryDestination)
727+ else CoderCLIManager .getDataDir(),
726728 settings.binarySource,
727729 )
728730 cliManager.configSsh(listTableModelOfWorkspaces.items)
Original file line number Diff line number Diff line change @@ -84,28 +84,28 @@ class CoderCLIManagerTest extends Specification {
8484 tmpdir. toFile(). deleteDir()
8585 }
8686
87- def " defaults to a sub-directory in the data directory" () {
87+ def " uses a sub-directory" () {
8888 given :
89- def ccm = new CoderCLIManager (new URL (" https://test.coder.invalid" ))
89+ def ccm = new CoderCLIManager (new URL (" https://test.coder.invalid" ), tmpdir )
9090
9191 expect :
92- ccm. localBinaryPath. getParent() == CoderCLIManager . getDataDir() . resolve(" test.coder.invalid" )
92+ ccm. localBinaryPath. getParent() == tmpdir . resolve(" test.coder.invalid" )
9393 }
9494
9595 def " includes port in sub-directory if included" () {
9696 given :
97- def ccm = new CoderCLIManager (new URL (" https://test.coder.invalid:3000" ))
97+ def ccm = new CoderCLIManager (new URL (" https://test.coder.invalid:3000" ), tmpdir )
9898
9999 expect :
100- ccm. localBinaryPath. getParent() == CoderCLIManager . getDataDir() . resolve(" test.coder.invalid-3000" )
100+ ccm. localBinaryPath. getParent() == tmpdir . resolve(" test.coder.invalid-3000" )
101101 }
102102
103103 def " encodes IDN with punycode" () {
104104 given :
105- def ccm = new CoderCLIManager (new URL (" https://test.😉.invalid" ))
105+ def ccm = new CoderCLIManager (new URL (" https://test.😉.invalid" ), tmpdir )
106106
107107 expect :
108- ccm. localBinaryPath. getParent() == CoderCLIManager . getDataDir() . resolve(" test.xn--n28h.invalid" )
108+ ccm. localBinaryPath. getParent() == tmpdir . resolve(" test.xn--n28h.invalid" )
109109 }
110110
111111 def " fails to download" () {
You can’t perform that action at this time.
0 commit comments