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") {
25
25
.comment(
26
26
CoderGatewayBundle .message(
27
27
" gateway.connector.settings.binary-source.comment" ,
28
- CoderCLIManager (URL (" http://localhost" )).remoteBinaryURL.path,
28
+ CoderCLIManager (URL (" http://localhost" ), CoderCLIManager .getDataDir() ).remoteBinaryURL.path,
29
29
)
30
30
)
31
31
}
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import javax.xml.bind.annotation.adapters.HexBinaryAdapter
25
25
*/
26
26
class CoderCLIManager @JvmOverloads constructor(
27
27
private val deploymentURL : URL ,
28
- destinationDir : Path ? = null ,
28
+ destinationDir : Path ,
29
29
remoteBinaryURLOverride : String? = null ,
30
30
private val sshConfigPath : Path = Path .of(System .getProperty("user.home")).resolve(".ssh/config"),
31
31
) {
@@ -49,11 +49,10 @@ class CoderCLIManager @JvmOverloads constructor(
49
49
remoteBinaryURL.withPath(remoteBinaryURLOverride)
50
50
}
51
51
}
52
- val dir = destinationDir ? : getDataDir()
53
52
val host = getSafeHost(deploymentURL)
54
53
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()
57
56
}
58
57
59
58
/* *
Original file line number Diff line number Diff line change @@ -467,7 +467,8 @@ class CoderWorkspacesStepView(val setNextButtonEnabled: (Boolean) -> Unit) : Cod
467
467
this .indicator.text = " Downloading Coder CLI..."
468
468
val cliManager = CoderCLIManager (
469
469
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(),
471
472
settings.binarySource,
472
473
)
473
474
cliManager.downloadCLI()
@@ -722,7 +723,8 @@ class CoderWorkspacesStepView(val setNextButtonEnabled: (Boolean) -> Unit) : Cod
722
723
logger.info(" Configuring Coder CLI..." )
723
724
val cliManager = CoderCLIManager (
724
725
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(),
726
728
settings.binarySource,
727
729
)
728
730
cliManager.configSsh(listTableModelOfWorkspaces.items)
Original file line number Diff line number Diff line change @@ -84,28 +84,28 @@ class CoderCLIManagerTest extends Specification {
84
84
tmpdir. toFile(). deleteDir()
85
85
}
86
86
87
- def " defaults to a sub-directory in the data directory" () {
87
+ def " uses a sub-directory" () {
88
88
given :
89
- def ccm = new CoderCLIManager (new URL (" https://test.coder.invalid" ))
89
+ def ccm = new CoderCLIManager (new URL (" https://test.coder.invalid" ), tmpdir )
90
90
91
91
expect :
92
- ccm. localBinaryPath. getParent() == CoderCLIManager . getDataDir() . resolve(" test.coder.invalid" )
92
+ ccm. localBinaryPath. getParent() == tmpdir . resolve(" test.coder.invalid" )
93
93
}
94
94
95
95
def " includes port in sub-directory if included" () {
96
96
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 )
98
98
99
99
expect :
100
- ccm. localBinaryPath. getParent() == CoderCLIManager . getDataDir() . resolve(" test.coder.invalid-3000" )
100
+ ccm. localBinaryPath. getParent() == tmpdir . resolve(" test.coder.invalid-3000" )
101
101
}
102
102
103
103
def " encodes IDN with punycode" () {
104
104
given :
105
- def ccm = new CoderCLIManager (new URL (" https://test.😉.invalid" ))
105
+ def ccm = new CoderCLIManager (new URL (" https://test.😉.invalid" ), tmpdir )
106
106
107
107
expect :
108
- ccm. localBinaryPath. getParent() == CoderCLIManager . getDataDir() . resolve(" test.xn--n28h.invalid" )
108
+ ccm. localBinaryPath. getParent() == tmpdir . resolve(" test.xn--n28h.invalid" )
109
109
}
110
110
111
111
def " fails to download" () {
You can’t perform that action at this time.
0 commit comments