wslc-wip 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wip/doctor.rb +13 -3
- data/lib/wip/environment.rb +20 -3
- data/lib/wip/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5808f27cf9f20fab582caacc33a35f4727d1b74764b8e541fe9f10a82ec8ceaa
|
|
4
|
+
data.tar.gz: 79c031022523b9ea21dfc79d7b160bcc46ab71cebe9f98d89050758ba581d986
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b64f0d01f0f54476b5acacc7094dc6c54f2ea5ed480272644b20839a9a1d3217d9c32748935eb20d75f5ee3672012d6c8799dfba8192b1fa656e16a7c65380f
|
|
7
|
+
data.tar.gz: 5ab533ffee65252d885c20862c32450f3d4b7c5c4a8019cf2314e5075b9c3f5ea49efd551f08cf73c170663b90cebe420533be7041e5d20c6eff1988e6b3a758
|
data/lib/wip/doctor.rb
CHANGED
|
@@ -15,9 +15,8 @@ module Wip
|
|
|
15
15
|
|
|
16
16
|
def call
|
|
17
17
|
results = []
|
|
18
|
-
results << result(@environment.wsl2? ? :ok : :fail,
|
|
19
|
-
results <<
|
|
20
|
-
'Windows executable interoperability is disabled')
|
|
18
|
+
results << result(@environment.wsl2? ? :ok : :fail, *wsl2_messages)
|
|
19
|
+
results << interop_result unless @environment.windows?
|
|
21
20
|
results << Result.new(:ok, "Architecture: #{@environment.architecture}")
|
|
22
21
|
config = load_config(results)
|
|
23
22
|
command = resolve(config, results) if config
|
|
@@ -29,6 +28,17 @@ module Wip
|
|
|
29
28
|
|
|
30
29
|
private
|
|
31
30
|
|
|
31
|
+
def wsl2_messages
|
|
32
|
+
return ['WSL2 is available', 'WSL2 is not available'] if @environment.windows?
|
|
33
|
+
|
|
34
|
+
['Running on WSL2', 'Not running on WSL2']
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def interop_result
|
|
38
|
+
result(@environment.windows_interop? ? :ok : :fail, 'Windows executable interoperability is enabled',
|
|
39
|
+
'Windows executable interoperability is disabled')
|
|
40
|
+
end
|
|
41
|
+
|
|
32
42
|
def load_config(results)
|
|
33
43
|
config = @loader.load
|
|
34
44
|
invalid = %w[container image].select { |key| config.defaults[key].to_s.empty? }
|
data/lib/wip/environment.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'open3'
|
|
4
|
+
|
|
3
5
|
module Wip
|
|
4
6
|
# Detects WSL2, Windows interop, and architecture facts about the host.
|
|
5
7
|
class Environment
|
|
@@ -8,7 +10,11 @@ module Wip
|
|
|
8
10
|
@stdout = stdout
|
|
9
11
|
end
|
|
10
12
|
|
|
13
|
+
def windows? = Gem.win_platform?
|
|
14
|
+
|
|
11
15
|
def wsl2?
|
|
16
|
+
return wsl2_backend_available? if windows?
|
|
17
|
+
|
|
12
18
|
File.read('/proc/version').match?(/microsoft.*WSL2/i)
|
|
13
19
|
rescue Errno::ENOENT
|
|
14
20
|
false
|
|
@@ -18,9 +24,20 @@ module Wip
|
|
|
18
24
|
def interactive? = @stdin.tty? && @stdout.tty?
|
|
19
25
|
|
|
20
26
|
def architecture
|
|
21
|
-
machine =
|
|
22
|
-
{ 'x86_64' => 'linux/amd64', 'aarch64' => 'linux/arm64', 'arm64' => 'linux/arm64' }
|
|
23
|
-
|
|
27
|
+
machine = RbConfig::CONFIG['host_cpu']
|
|
28
|
+
{ 'x86_64' => 'linux/amd64', 'x64' => 'linux/amd64', 'aarch64' => 'linux/arm64', 'arm64' => 'linux/arm64' }
|
|
29
|
+
.fetch(machine, "linux/#{machine}")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
# On native Windows there is no /proc/version to read, so ask Windows
|
|
35
|
+
# itself whether the WSL2 backend that WSLC depends on is installed.
|
|
36
|
+
def wsl2_backend_available?
|
|
37
|
+
_output, status = Open3.capture2e('wsl.exe', '--status')
|
|
38
|
+
status.success?
|
|
39
|
+
rescue Errno::ENOENT
|
|
40
|
+
false
|
|
24
41
|
end
|
|
25
42
|
end
|
|
26
43
|
end
|
data/lib/wip/version.rb
CHANGED