native-package-installer 1.1.1 → 1.1.4
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/doc/text/news.md +31 -0
- data/lib/native-package-installer/os-release.rb +55 -0
- data/lib/native-package-installer/platform/alt-linux.rb +12 -5
- data/{test/run-test.rb → lib/native-package-installer/platform/amazon-linux.rb} +23 -7
- data/lib/native-package-installer/platform/debian.rb +9 -11
- data/lib/native-package-installer/platform/fedora.rb +4 -3
- data/lib/native-package-installer/platform/msys2.rb +3 -1
- data/lib/native-package-installer/platform/{redhat.rb → red-hat-enterprise-linux.rb} +5 -4
- data/lib/native-package-installer/platform/suse.rb +4 -3
- data/lib/native-package-installer/platform/ubuntu.rb +9 -5
- data/lib/native-package-installer/platform.rb +32 -18
- data/lib/native-package-installer/version.rb +2 -2
- data/lib/native-package-installer.rb +6 -4
- metadata +8 -52
- data/test/test-executable-finder.rb +0 -90
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19dbe539e67e615403c379579a487662f8a499e80a43655b71318c564cd41c32
|
4
|
+
data.tar.gz: 26896ad5978fe06d6ac3330b52b354a1afd7f892a00d2306ba1d5e01df972949
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d9d33138bdfacba49aa33656a58c0b18cf0a961d1f3af83b8f147c40a1d307f8960755a4cd030955ecfa1f7a5cfc218393517821afa3a5969436801c008945a
|
7
|
+
data.tar.gz: 8b146df8007452ca25c470f31140df2326270815fb4195ee167c52b32305dc9906044d425063cd4f1ab86d9d9207f1065165a9ed4949934c03d83d7de944bb53
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 1.1.4 - 2022-03-17
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* Added support for Amazon Linux.
|
8
|
+
[GitHub#14][Reported by docusend1]
|
9
|
+
|
10
|
+
* Renamed the key for Red Hat Enterprise Linux based system such as
|
11
|
+
AlmaLinux and CentOS to `:rhel` from `:redhat`. `:redhat` still
|
12
|
+
can be used to keep backward compatibility.
|
13
|
+
|
14
|
+
### Thanks
|
15
|
+
|
16
|
+
* docusend1
|
17
|
+
|
18
|
+
## 1.1.3 - 2022-01-18
|
19
|
+
|
20
|
+
### Fixes
|
21
|
+
|
22
|
+
* Fixed wrong package install on Windows.
|
23
|
+
|
24
|
+
## 1.1.2 - 2022-01-18
|
25
|
+
|
26
|
+
### Improvements
|
27
|
+
|
28
|
+
* Changed priority for Homebrew on Linux. System package manager is preferred.
|
29
|
+
|
30
|
+
* Improved OpenSuSE detection.
|
31
|
+
|
32
|
+
* Added support for Ruby 3.1 based RubyInstaller.
|
33
|
+
|
3
34
|
## 1.1.1 - 2021-01-17
|
4
35
|
|
5
36
|
### 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,6 +1,4 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# Copyright (C) 2013 Ruby-GNOME Project Team
|
1
|
+
# Copyright (C) 2022 Ruby-GNOME Project Team
|
4
2
|
#
|
5
3
|
# This library is free software: you can redistribute it and/or modify
|
6
4
|
# it under the terms of the GNU Lesser General Public License as published by
|
@@ -15,9 +13,27 @@
|
|
15
13
|
# You should have received a copy of the GNU Lesser General Public License
|
16
14
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
15
|
|
18
|
-
|
16
|
+
require_relative "red-hat-enterprise-linux"
|
17
|
+
|
18
|
+
class NativePackageInstaller
|
19
|
+
module Platform
|
20
|
+
class AmazonLinux < RedHatEnterpriseLinux
|
21
|
+
Platform.register(self)
|
22
|
+
|
23
|
+
class << self
|
24
|
+
def current_platform?
|
25
|
+
os_release = OSRelease.new
|
26
|
+
os_release.id == "amzn"
|
27
|
+
end
|
28
|
+
end
|
19
29
|
|
20
|
-
|
21
|
-
|
30
|
+
def package(spec)
|
31
|
+
spec[:amazon_linux] || super
|
32
|
+
end
|
22
33
|
|
23
|
-
|
34
|
+
def install_command
|
35
|
+
"yum install -y"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
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,12 +20,13 @@ 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
|
|
27
28
|
def package(spec)
|
28
|
-
spec[:fedora] || spec[:redhat]
|
29
|
+
spec[:fedora] || spec[:rhel] || spec[:redhat]
|
29
30
|
end
|
30
31
|
|
31
32
|
def install_command
|
@@ -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
|
@@ -15,17 +15,18 @@
|
|
15
15
|
|
16
16
|
class NativePackageInstaller
|
17
17
|
module Platform
|
18
|
-
class
|
18
|
+
class RedHatEnterpriseLinux
|
19
19
|
Platform.register(self)
|
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
|
|
27
28
|
def package(spec)
|
28
|
-
spec[:redhat]
|
29
|
+
spec[:rhel] || spec[:redhat]
|
29
30
|
end
|
30
31
|
|
31
32
|
def install_command
|
@@ -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,12 +20,13 @@ 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
|
|
27
28
|
def package(spec)
|
28
|
-
spec[:suse] || spec[:fedora] || spec[:redhat]
|
29
|
+
spec[:suse] || spec[:fedora] || spec[:rhel] || spec[:redhat]
|
29
30
|
end
|
30
31
|
|
31
32
|
def install_command
|
@@ -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-2022 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,45 @@ 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
|
+
# macOS
|
37
|
+
require_relative "platform/macports"
|
39
38
|
|
40
|
-
|
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"
|
39
|
+
require_relative "platform/homebrew"
|
48
40
|
|
49
|
-
require "native-package-installer/platform/homebrew"
|
50
41
|
|
51
|
-
|
42
|
+
# FreeBSD
|
43
|
+
require_relative "platform/freebsd"
|
52
44
|
|
53
|
-
|
45
|
+
|
46
|
+
# Linux
|
47
|
+
require_relative "platform/arch-linux"
|
48
|
+
|
49
|
+
require_relative "platform/debian"
|
50
|
+
require_relative "platform/ubuntu"
|
51
|
+
require_relative "platform/alt-linux"
|
52
|
+
|
53
|
+
require_relative "platform/pld-linux"
|
54
|
+
|
55
|
+
require_relative "platform/red-hat-enterprise-linux"
|
56
|
+
require_relative "platform/amazon-linux"
|
57
|
+
require_relative "platform/fedora"
|
58
|
+
|
59
|
+
require_relative "platform/suse"
|
60
|
+
|
61
|
+
|
62
|
+
# Windows
|
63
|
+
require_relative "platform/msys2"
|
64
|
+
|
65
|
+
|
66
|
+
# Fallback
|
67
|
+
require_relative "platform/unknown"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013-
|
1
|
+
# Copyright (C) 2013-2022 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
|
@@ -14,5 +14,5 @@
|
|
14
14
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
|
16
16
|
class NativePackageInstaller
|
17
|
-
VERSION = "1.1.
|
17
|
+
VERSION = "1.1.4"
|
18
18
|
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
|
@@ -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
|
metadata
CHANGED
@@ -1,57 +1,15 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: test-unit-rr
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
11
|
+
date: 2022-03-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
55
13
|
description: |-
|
56
14
|
Users need to install native packages to install an extension library
|
57
15
|
that depends on native packages. It bores users because users need to
|
@@ -73,8 +31,10 @@ files:
|
|
73
31
|
- doc/text/news.md
|
74
32
|
- lib/native-package-installer.rb
|
75
33
|
- lib/native-package-installer/executable-finder.rb
|
34
|
+
- lib/native-package-installer/os-release.rb
|
76
35
|
- lib/native-package-installer/platform.rb
|
77
36
|
- lib/native-package-installer/platform/alt-linux.rb
|
37
|
+
- lib/native-package-installer/platform/amazon-linux.rb
|
78
38
|
- lib/native-package-installer/platform/arch-linux.rb
|
79
39
|
- lib/native-package-installer/platform/debian.rb
|
80
40
|
- lib/native-package-installer/platform/fedora.rb
|
@@ -83,13 +43,11 @@ files:
|
|
83
43
|
- lib/native-package-installer/platform/macports.rb
|
84
44
|
- lib/native-package-installer/platform/msys2.rb
|
85
45
|
- lib/native-package-installer/platform/pld-linux.rb
|
86
|
-
- lib/native-package-installer/platform/
|
46
|
+
- lib/native-package-installer/platform/red-hat-enterprise-linux.rb
|
87
47
|
- lib/native-package-installer/platform/suse.rb
|
88
48
|
- lib/native-package-installer/platform/ubuntu.rb
|
89
49
|
- lib/native-package-installer/platform/unknown.rb
|
90
50
|
- lib/native-package-installer/version.rb
|
91
|
-
- test/run-test.rb
|
92
|
-
- test/test-executable-finder.rb
|
93
51
|
homepage: https://github.com/ruby-gnome/native-package-installer
|
94
52
|
licenses:
|
95
53
|
- LGPL-3+
|
@@ -109,10 +67,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
67
|
- !ruby/object:Gem::Version
|
110
68
|
version: '0'
|
111
69
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
70
|
+
rubygems_version: 3.4.0.dev
|
113
71
|
signing_key:
|
114
72
|
specification_version: 4
|
115
73
|
summary: native-package-installer helps to install native packages on "gem install"
|
116
|
-
test_files:
|
117
|
-
- test/run-test.rb
|
118
|
-
- test/test-executable-finder.rb
|
74
|
+
test_files: []
|
@@ -1,90 +0,0 @@
|
|
1
|
-
# Copyright (C) 2013 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
|
-
require "fileutils"
|
17
|
-
|
18
|
-
require "native-package-installer/executable-finder"
|
19
|
-
|
20
|
-
class ExecutableFinderTest < Test::Unit::TestCase
|
21
|
-
def setup
|
22
|
-
@original_path = ENV["PATH"]
|
23
|
-
setup_base_dir
|
24
|
-
setup_path
|
25
|
-
end
|
26
|
-
|
27
|
-
def setup_base_dir
|
28
|
-
@base_dir = File.join(File.dirname(__FILE__), "tmp")
|
29
|
-
FileUtils.rm_rf(@base_dir)
|
30
|
-
FileUtils.mkdir_p(@base_dir)
|
31
|
-
end
|
32
|
-
|
33
|
-
def teardown_base_dir
|
34
|
-
FileUtils.rm_rf(@base_dir)
|
35
|
-
end
|
36
|
-
|
37
|
-
def setup_path
|
38
|
-
paths = [
|
39
|
-
File.join(@base_dir, "nonexistent"),
|
40
|
-
File.join(@base_dir, "bin"),
|
41
|
-
File.join(@base_dir, "sbin"),
|
42
|
-
]
|
43
|
-
ENV["PATH"] = paths.join(File::PATH_SEPARATOR)
|
44
|
-
end
|
45
|
-
|
46
|
-
def teardown
|
47
|
-
teardown_base_dir
|
48
|
-
ENV["PATH"] = @original_path
|
49
|
-
end
|
50
|
-
|
51
|
-
private
|
52
|
-
def create_finder(basename)
|
53
|
-
NativePackageInstaller::ExecutableFinder.new(basename)
|
54
|
-
end
|
55
|
-
|
56
|
-
class TestFind < self
|
57
|
-
def test_found
|
58
|
-
finder = create_finder("ls")
|
59
|
-
ls = File.join(@base_dir, "bin", "ls")
|
60
|
-
stub(File).stat(ls) do
|
61
|
-
stat = stub(Object.new)
|
62
|
-
stat.file? {true}
|
63
|
-
stat.executable? {true}
|
64
|
-
stat
|
65
|
-
end
|
66
|
-
stub(File).stat.with_any_args do
|
67
|
-
raise Errno::ENOENT
|
68
|
-
end
|
69
|
-
assert_equal(ls, finder.find)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
class TestExist < self
|
74
|
-
def test_true
|
75
|
-
finder = create_finder("ls")
|
76
|
-
stub(finder).find do
|
77
|
-
File.join(@base_dir, "bin", "ls")
|
78
|
-
end
|
79
|
-
assert_true(finder.exist?)
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_false
|
83
|
-
finder = create_finder("ls")
|
84
|
-
stub(finder).find do
|
85
|
-
nil
|
86
|
-
end
|
87
|
-
assert_false(finder.exist?)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|