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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 685c2e4edcc91906cd86fe043ac708f5e13d5abdea21f3e5eb6cc0607bd2c5ed
4
- data.tar.gz: a8b9a9ae28e64180015b6c63b7d7e82915a5b38e22df138680705748c8a3c9ef
3
+ metadata.gz: 3493a52f0b4f777199e3b7f22f912496d0bd33840782aca042308576343622d7
4
+ data.tar.gz: 844d89eeae53b9c5de0bcd359d647de97d4096e0256d75785f8888ccab635dc0
5
5
  SHA512:
6
- metadata.gz: 8e0b8127692a652b625c17c94740a1202e1fafcb6a02b14e6658798ab72f53109a7b49ca02c788ea61264ae9b2b2d21968e8c612b023dfeca14ec29fecac544e
7
- data.tar.gz: c1e1a4006bddac350fd68b54f9b09fe46d0360810c8223fda7282d33cc7828ce3981b22e3cd0b00b690c4433827cb3940681fb55b7918b243425db00562e28c0
6
+ metadata.gz: d718c9b5ccb96cfcd5823aa7c6a94d3b94b9c9e41f78f97c0fef4494534e0e0fe4954416c405e7ab22e27ed8389fb27726de16da8d258841b9f3b69d8eb7e330
7
+ data.tar.gz: '0104599df035623ef931b5e2c97bec707496a31ffa7d1b099ba15fa8fbd32967491ddbdbcc4d752521e4996c9bcb89e45ccb4ac0fec7bdb942d1b092d02896a7'
@@ -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
- distro[:pkgman] = nil
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
@@ -151,7 +151,7 @@ module Plat4m
151
151
  end
152
152
 
153
153
  def detect_current
154
- case RbConfig::CONFIG['host_os']
154
+ case RbConfig::CONFIG['target_os']
155
155
  when /linux/
156
156
  sniffers[:linux].detect_system
157
157
  when /darwin/
@@ -8,6 +8,6 @@
8
8
  module Plat4m
9
9
 
10
10
  # Current Plat4m version.
11
- VERSION = '1.0.4'
11
+ VERSION = '1.1.1'
12
12
 
13
13
  end
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
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-02-21 00:00:00.000000000 Z
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.3
51
+ rubygems_version: 3.5.16
52
52
  signing_key:
53
53
  specification_version: 4
54
54
  summary: Runtime system detection.