plat4m 1.0.4 → 1.1.0
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/plat4m/sniff/windows.rb +41 -2
- data/lib/plat4m/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 621a047257bbe5f26b4871b2cc0796a0e481f5455557677dffced74b6c5222b0
|
4
|
+
data.tar.gz: d59bbdfb5f7f2953036107d236b2cef7b051097e3c9ddb210f9f4bcaedcc4e38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b87380835e075321ee7cb821bc6e4a5bf87b6e7d77c5c27d9eaf0064a311225841be9353d09106904452ed5642e26f05bc15276a2ca28177faa30c2c3efa9835
|
7
|
+
data.tar.gz: 7b99a8ed3600e6c7111d3b96b36332d7fb6284e2223b12eb4e9f6f8aac1e1d7a1f8dc46fb03fe218272f499ee7d816a5104b91d22665dd36609e89d853a86179
|
data/lib/plat4m/sniff/windows.rb
CHANGED
@@ -33,19 +33,58 @@ module Plat4m
|
|
33
33
|
|
34
34
|
def get_distro
|
35
35
|
distro = {
|
36
|
-
distro: 'windows'
|
36
|
+
distro: RUBY_PLATFORM.match?(/mingw/i) ? 'mingw' : 'windows'
|
37
37
|
}
|
38
38
|
# the 'ver' command returns something like "Microsoft Windows [Version xx.xx.xx.xx]"
|
39
39
|
match = `ver`.strip.match(/\[(.*)\]/)
|
40
40
|
ver = match[1].split.last
|
41
41
|
distro[:release] = ver.split('.').shift
|
42
42
|
distro[:version] = ver
|
43
|
-
|
43
|
+
# in case of MingW built Ruby assume availability of RubyInstaller Devkit
|
44
|
+
distro[:pkgman] = distro[:distro]=='mingw' ? Pacman.new(distro) : nil
|
44
45
|
distro
|
45
46
|
end
|
46
47
|
|
47
48
|
end
|
48
49
|
|
50
|
+
class Pacman < PkgManager
|
51
|
+
|
52
|
+
def initialize(_distro)
|
53
|
+
super()
|
54
|
+
end
|
55
|
+
|
56
|
+
def make_install_command(*pkgs)
|
57
|
+
pacman_cmd("-S --needed #{ pkgs.join(' ') }")
|
58
|
+
end
|
59
|
+
|
60
|
+
def install(*pkgs, silent: false)
|
61
|
+
run(make_install_command, silent: silent)
|
62
|
+
end
|
63
|
+
|
64
|
+
def make_uninstall_command(*pkgs)
|
65
|
+
pacman_cmd("-Rsu #{pkgs.flatten.join(' ')}")
|
66
|
+
end
|
67
|
+
|
68
|
+
def installed?(pkg)
|
69
|
+
run("pacman -Qq #{pkg}", silent: true)
|
70
|
+
end
|
71
|
+
|
72
|
+
def available?(pkg)
|
73
|
+
run(%Q[pacman -Ss '^#{pkg}$'], silent: true)
|
74
|
+
end
|
75
|
+
|
76
|
+
protected
|
77
|
+
|
78
|
+
def run(cmd, silent: false)
|
79
|
+
system(%Q[bash -c "#{cmd}#{silent ? ' >/dev/null 2>&1' : ''}"])
|
80
|
+
end
|
81
|
+
|
82
|
+
def pacman_cmd(cmd)
|
83
|
+
"pacman --noconfirm #{cmd}"
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
49
88
|
end
|
50
89
|
|
51
90
|
end
|
data/lib/plat4m/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plat4m
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Corino
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Plat4m is a simple runtime system platform scouting and support library.
|
14
14
|
email: mcorino@m2c-software.nl
|
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
requirements: []
|
51
|
-
rubygems_version: 3.5.
|
51
|
+
rubygems_version: 3.5.9
|
52
52
|
signing_key:
|
53
53
|
specification_version: 4
|
54
54
|
summary: Runtime system detection.
|