native-package-installer 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +10 -0
- data/lib/native-package-installer/os-release.rb +55 -0
- data/lib/native-package-installer/platform/alt-linux.rb +12 -5
- data/lib/native-package-installer/platform/debian.rb +9 -11
- data/lib/native-package-installer/platform/fedora.rb +3 -2
- data/lib/native-package-installer/platform/msys2.rb +3 -1
- data/lib/native-package-installer/platform/redhat.rb +3 -2
- data/lib/native-package-installer/platform/suse.rb +3 -2
- data/lib/native-package-installer/platform/ubuntu.rb +9 -5
- data/lib/native-package-installer/platform.rb +31 -18
- data/lib/native-package-installer/version.rb +1 -1
- data/lib/native-package-installer.rb +6 -4
- data/test/run-test.rb +7 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f81b6a31d687db3d8f2b8a18e81b1a5fcd89531561940774c31b115e2068d4ee
|
4
|
+
data.tar.gz: 3f015fe58c1046a6db4adae8ca89487f136e2155ac3de47efe142fdd6b02c58f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6ce52d9eb449fe1ec2a98a83d6e719eb9e301e00122dc676e18871c5d00660c1c5331dc9dfa5903eabebecef4fe891e60479b1893f96f95f50a4f9d992f2510
|
7
|
+
data.tar.gz: feaa63f0b76edeea500b41ec03d442122763f63b7abbf8aa05cb47f614d301eb9eccbc36584568e86e60d3c294eb4e945aa97949515d0134f3d19f43ea95ba7f
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 1.1.2 - 2022-01-18
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* Changed priority for Homebrew on Linux. System package manager is preferred.
|
8
|
+
|
9
|
+
* Improved OpenSuSE detection.
|
10
|
+
|
11
|
+
* Added support for Ruby 3.1 based RubyInstaller.
|
12
|
+
|
3
13
|
## 1.1.1 - 2021-01-17
|
4
14
|
|
5
15
|
### Improvements
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Copyright (C) 2021 Ruby-GNOME Project Team
|
2
|
+
#
|
3
|
+
# This library is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
class NativePackageInstaller
|
17
|
+
class OSRelease
|
18
|
+
include Enumerable
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
parse
|
22
|
+
end
|
23
|
+
|
24
|
+
def each(&block)
|
25
|
+
@variables.each(&block)
|
26
|
+
end
|
27
|
+
|
28
|
+
def [](key)
|
29
|
+
@variables[key]
|
30
|
+
end
|
31
|
+
|
32
|
+
def id
|
33
|
+
self["ID"]
|
34
|
+
end
|
35
|
+
|
36
|
+
def id_like
|
37
|
+
(self["ID_LIKE"] || "").split(/ /)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
def parse
|
42
|
+
@variables = {}
|
43
|
+
path = "/etc/os-release"
|
44
|
+
return unless File.exist?(path)
|
45
|
+
File.foreach(path) do |line|
|
46
|
+
key, value = line.strip.split("=", 2)
|
47
|
+
next if value.nil?
|
48
|
+
if value.start_with?("\"") and value.end_with?("\"")
|
49
|
+
value = value[1..-2]
|
50
|
+
end
|
51
|
+
@variables[key] = value
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2017 Ruby-GNOME Project Team
|
1
|
+
# Copyright (C) 2017-2021 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU Lesser General Public License as published by
|
@@ -13,22 +13,29 @@
|
|
13
13
|
# You should have received a copy of the GNU Lesser General Public License
|
14
14
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
|
16
|
-
require "native-package-installer/platform/debian"
|
17
|
-
|
18
16
|
class NativePackageInstaller
|
19
17
|
module Platform
|
20
|
-
class ALTLinux
|
18
|
+
class ALTLinux
|
21
19
|
Platform.register(self)
|
22
20
|
|
23
21
|
class << self
|
24
22
|
def current_platform?
|
25
|
-
|
23
|
+
os_release = OSRelease.new
|
24
|
+
os_release.id == "altlinux"
|
26
25
|
end
|
27
26
|
end
|
28
27
|
|
29
28
|
def package(spec)
|
30
29
|
spec[:alt_linux]
|
31
30
|
end
|
31
|
+
|
32
|
+
def install_command
|
33
|
+
"apt-get install -V -y"
|
34
|
+
end
|
35
|
+
|
36
|
+
def need_super_user_priviledge?
|
37
|
+
true
|
38
|
+
end
|
32
39
|
end
|
33
40
|
end
|
34
41
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013-
|
1
|
+
# Copyright (C) 2013-2021 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU Lesser General Public License as published by
|
@@ -20,16 +20,14 @@ class NativePackageInstaller
|
|
20
20
|
|
21
21
|
class << self
|
22
22
|
def current_platform?
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
return true
|
30
|
-
end
|
23
|
+
os_release = OSRelease.new
|
24
|
+
case os_release.id
|
25
|
+
when "debian", "raspbian"
|
26
|
+
return true
|
27
|
+
else
|
28
|
+
return true if os_release.id_like.include?("debian")
|
31
29
|
end
|
32
|
-
|
30
|
+
false
|
33
31
|
end
|
34
32
|
end
|
35
33
|
|
@@ -38,7 +36,7 @@ class NativePackageInstaller
|
|
38
36
|
end
|
39
37
|
|
40
38
|
def install_command
|
41
|
-
"apt install -V -y"
|
39
|
+
"apt-get install -V -y"
|
42
40
|
end
|
43
41
|
|
44
42
|
def need_super_user_priviledge?
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C)
|
1
|
+
# Copyright (C) 2021 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU Lesser General Public License as published by
|
@@ -20,7 +20,8 @@ class NativePackageInstaller
|
|
20
20
|
|
21
21
|
class << self
|
22
22
|
def current_platform?
|
23
|
-
|
23
|
+
os_release = OSRelease.new
|
24
|
+
os_release.id == "fedora"
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
@@ -31,7 +31,7 @@ class NativePackageInstaller
|
|
31
31
|
Dir.glob("c:/msys{64,32,*}/usr/bin") do |bin|
|
32
32
|
finder.append_path(bin)
|
33
33
|
end
|
34
|
-
when "x64-mingw32"
|
34
|
+
when "x64-mingw32", "x64-mingw-ucrt"
|
35
35
|
Dir.glob("c:/msys{64,*}/usr/bin") do |bin|
|
36
36
|
finder.append_path(bin)
|
37
37
|
end
|
@@ -45,6 +45,8 @@ class NativePackageInstaller
|
|
45
45
|
"mingw-w64-i686-"
|
46
46
|
when "x64-mingw32"
|
47
47
|
"mingw-w64-x86_64-"
|
48
|
+
when "x64-mingw-ucrt"
|
49
|
+
"mingw-w64-ucrt-x86_64-"
|
48
50
|
else
|
49
51
|
nil
|
50
52
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2017-
|
1
|
+
# Copyright (C) 2017-2021 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU Lesser General Public License as published by
|
@@ -20,7 +20,8 @@ class NativePackageInstaller
|
|
20
20
|
|
21
21
|
class << self
|
22
22
|
def current_platform?
|
23
|
-
|
23
|
+
os_release = OSRelease.new
|
24
|
+
os_release.id_like.include?("rhel")
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2017 Ruby-GNOME Project Team
|
1
|
+
# Copyright (C) 2017-2021 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU Lesser General Public License as published by
|
@@ -20,7 +20,8 @@ class NativePackageInstaller
|
|
20
20
|
|
21
21
|
class << self
|
22
22
|
def current_platform?
|
23
|
-
|
23
|
+
os_release = OSRelease.new
|
24
|
+
os_release.id_like.include?("suse")
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C)
|
1
|
+
# Copyright (C) 2021 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU Lesser General Public License as published by
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# You should have received a copy of the GNU Lesser General Public License
|
14
14
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
|
16
|
-
|
16
|
+
require_relative "debian"
|
17
17
|
|
18
18
|
class NativePackageInstaller
|
19
19
|
module Platform
|
@@ -22,10 +22,14 @@ class NativePackageInstaller
|
|
22
22
|
|
23
23
|
class << self
|
24
24
|
def current_platform?
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
os_release = OSRelease.new
|
26
|
+
case os_release.id
|
27
|
+
when "ubuntu"
|
28
|
+
return true
|
29
|
+
else
|
30
|
+
return true if os_release.id_like.include?("ubuntu")
|
28
31
|
end
|
32
|
+
false
|
29
33
|
end
|
30
34
|
end
|
31
35
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2017-
|
1
|
+
# Copyright (C) 2017-2021 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU Lesser General Public License as published by
|
@@ -23,31 +23,44 @@ class NativePackageInstaller
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def detect
|
26
|
-
|
27
|
-
platform_class.current_platform?
|
26
|
+
PLATFORM_CLASSES.reverse_each do |platform_class|
|
27
|
+
return platform_class.new if platform_class.current_platform?
|
28
28
|
end
|
29
|
-
|
30
|
-
platform_class.new
|
29
|
+
Unknown.new
|
31
30
|
end
|
32
31
|
end
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
36
|
-
require "native-package-installer/platform/msys2"
|
37
35
|
|
38
|
-
|
36
|
+
# Windows
|
37
|
+
require_relative "platform/msys2"
|
39
38
|
|
40
|
-
require "native-package-installer/platform/alt-linux"
|
41
|
-
require "native-package-installer/platform/arch-linux"
|
42
|
-
require "native-package-installer/platform/debian"
|
43
|
-
require "native-package-installer/platform/fedora"
|
44
|
-
require "native-package-installer/platform/pld-linux"
|
45
|
-
require "native-package-installer/platform/redhat"
|
46
|
-
require "native-package-installer/platform/suse"
|
47
|
-
require "native-package-installer/platform/ubuntu"
|
48
39
|
|
49
|
-
|
40
|
+
# macOS
|
41
|
+
require_relative "platform/macports"
|
50
42
|
|
51
|
-
|
43
|
+
require_relative "platform/homebrew"
|
52
44
|
|
53
|
-
|
45
|
+
|
46
|
+
# FreeBSD
|
47
|
+
require_relative "platform/freebsd"
|
48
|
+
|
49
|
+
|
50
|
+
# Linux
|
51
|
+
require_relative "platform/arch-linux"
|
52
|
+
|
53
|
+
require_relative "platform/debian"
|
54
|
+
require_relative "platform/ubuntu"
|
55
|
+
require_relative "platform/alt-linux"
|
56
|
+
|
57
|
+
require_relative "platform/pld-linux"
|
58
|
+
|
59
|
+
require_relative "platform/redhat"
|
60
|
+
require_relative "platform/fedora"
|
61
|
+
|
62
|
+
require_relative "platform/suse"
|
63
|
+
|
64
|
+
|
65
|
+
# Fallback
|
66
|
+
require_relative "platform/unknown"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2017 Ruby-GNOME Project Team
|
1
|
+
# Copyright (C) 2017-2021 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU Lesser General Public License as published by
|
@@ -15,10 +15,12 @@
|
|
15
15
|
|
16
16
|
require "shellwords"
|
17
17
|
|
18
|
-
|
18
|
+
require_relative "native-package-installer/version"
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
require_relative "native-package-installer/executable-finder"
|
21
|
+
require_relative "native-package-installer/os-release"
|
22
|
+
|
23
|
+
require_relative "native-package-installer/platform"
|
22
24
|
|
23
25
|
class NativePackageInstaller
|
24
26
|
class << self
|
data/test/run-test.rb
CHANGED
@@ -20,4 +20,10 @@ $VERBOSE = true
|
|
20
20
|
require "test-unit"
|
21
21
|
require "test/unit/rr"
|
22
22
|
|
23
|
-
|
23
|
+
base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
24
|
+
lib_dir = File.join(base_dir, "lib")
|
25
|
+
test_dir = File.join(base_dir, "test")
|
26
|
+
|
27
|
+
$LOAD_PATH.unshift(lib_dir)
|
28
|
+
|
29
|
+
exit(Test::Unit::AutoRunner.run(true, test_dir))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: native-package-installer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- doc/text/news.md
|
74
74
|
- lib/native-package-installer.rb
|
75
75
|
- lib/native-package-installer/executable-finder.rb
|
76
|
+
- lib/native-package-installer/os-release.rb
|
76
77
|
- lib/native-package-installer/platform.rb
|
77
78
|
- lib/native-package-installer/platform/alt-linux.rb
|
78
79
|
- lib/native-package-installer/platform/arch-linux.rb
|
@@ -109,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
110
|
- !ruby/object:Gem::Version
|
110
111
|
version: '0'
|
111
112
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
113
|
+
rubygems_version: 3.4.0.dev
|
113
114
|
signing_key:
|
114
115
|
specification_version: 4
|
115
116
|
summary: native-package-installer helps to install native packages on "gem install"
|