plat4m 1.1.2 → 1.1.4

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: 4481fa20e386ce17cb2e32497e4751ef06a0c8fe8f6924ccc39123ef39b1d7fc
4
- data.tar.gz: abe2c6c42b690c0d62f2172cf7fa105d8f18979f34c5ea0bcf8dc1df2a7c26aa
3
+ metadata.gz: '0568f72f0ee486986fb69681365388282d6a3ebce70cdd6aa7124b2c5ec7286e'
4
+ data.tar.gz: 9c6b999ec6a913a576a1ce05f242f6a6a8e8bcff45a9ed67ef81ce0db7f177b7
5
5
  SHA512:
6
- metadata.gz: fc950cde9aa00a2b3071db15c912bc946b931aeac7afc6f823a7083a21a97bd6d8fdf04eedfd6a6140f9ee3c94132fd6e7f4b75f1b3efb1d67fe9e1c3a295923
7
- data.tar.gz: b4d5e19123e3651fdbcb2b6ddc96f817750a809f04add82a7b08353898dfae08f733d3a523fa93954c629a8666aba813e9323a3accf06eabbc862f1f34f412f1
6
+ metadata.gz: a1bf2e5b82143028990f8dc384228ab58d4bf861d7d2ee826ad40e1b734e7dc86748b0d0ed4ccc298fa56064c889e21ca82148faaf00d7ba831a86915d58ea1e
7
+ data.tar.gz: e06c38c1caa125f661446fec555ce6da4541259419fe680c4474de1a89a96e21d7dcdc37e4ffc71acf490b2fe722bd35c4e13f2b0939cdda847fdd1aa12d5ef0
@@ -94,8 +94,9 @@ module Plat4m
94
94
 
95
95
  class NixManager < PkgManager
96
96
 
97
- def initialize(_distro)
97
+ def initialize(distro)
98
98
  super()
99
+ @distro = distro
99
100
  @has_sudo = system('command -v sudo > /dev/null')
100
101
  end
101
102
 
@@ -176,7 +177,13 @@ module Plat4m
176
177
  class Dnf < NixManager
177
178
 
178
179
  def installed?(pkg)
179
- system("dnf list installed #{pkg} >/dev/null 2>&1")
180
+ if @distro[:release] >= '41'
181
+ # dnf v5
182
+ system("dnf list --installed #{pkg} >/dev/null 2>&1")
183
+ else
184
+ # dnf <= v4
185
+ system("dnf list installed #{pkg} >/dev/null 2>&1")
186
+ end
180
187
  end
181
188
 
182
189
  def available?(pkg)
@@ -35,11 +35,18 @@ module Plat4m
35
35
  distro = {
36
36
  distro: RUBY_PLATFORM.match?(/mingw/i) ? 'mingw' : 'windows'
37
37
  }
38
- # the 'ver' command returns something like "Microsoft Windows [Version xx.xx.xx.xx]"
39
- match = `ver`.strip.match(/\[(.*)\]/)
40
- ver = match[1].split.last
41
- distro[:release] = ver.split('.').shift
38
+ # the 'ver' command outputs something like "Microsoft Windows [Version xx.xx.xx.xx]"
39
+ # the 'for ...' statement parses this and echos only the 'xx.xx.xx.xx' part
40
+ ver = `for /f "tokens=2 delims=[]" %s in ('ver') do @(for /f "tokens=2" %v in ('echo %s') do @echo %v)`.strip
42
41
  distro[:version] = ver
42
+ build = ver.split('.')[2].to_i
43
+ distro[:release] = if build >= 22000
44
+ '11'
45
+ elsif build >= 10240
46
+ '10'
47
+ else
48
+ '<10'
49
+ end
43
50
  # in case of MingW built Ruby assume availability of RubyInstaller Devkit
44
51
  distro[:pkgman] = distro[:distro]=='mingw' ? Pacman.new(distro) : nil
45
52
  distro
@@ -8,6 +8,6 @@
8
8
  module Plat4m
9
9
 
10
10
  # Current Plat4m version.
11
- VERSION = '1.1.2'
11
+ VERSION = '1.1.4'
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.1.2
4
+ version: 1.1.4
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-09-30 00:00:00.000000000 Z
11
+ date: 2024-11-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