plat4m 1.0.4 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/plat4m/sniff/windows.rb +41 -2
- data/lib/plat4m/system.rb +1 -1
- 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: 3493a52f0b4f777199e3b7f22f912496d0bd33840782aca042308576343622d7
|
4
|
+
data.tar.gz: 844d89eeae53b9c5de0bcd359d647de97d4096e0256d75785f8888ccab635dc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d718c9b5ccb96cfcd5823aa7c6a94d3b94b9c9e41f78f97c0fef4494534e0e0fe4954416c405e7ab22e27ed8389fb27726de16da8d258841b9f3b69d8eb7e330
|
7
|
+
data.tar.gz: '0104599df035623ef931b5e2c97bec707496a31ffa7d1b099ba15fa8fbd32967491ddbdbcc4d752521e4996c9bcb89e45ccb4ac0fec7bdb942d1b092d02896a7'
|
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/system.rb
CHANGED
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.
|
4
|
+
version: 1.1.1
|
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-09-29 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.16
|
52
52
|
signing_key:
|
53
53
|
specification_version: 4
|
54
54
|
summary: Runtime system detection.
|