native-package-installer 1.0.8 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -3
- data/Rakefile +1 -1
- data/doc/text/news.md +49 -0
- data/lib/native-package-installer/executable-finder.rb +1 -1
- 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/arch-linux.rb +1 -1
- data/lib/native-package-installer/platform/debian.rb +10 -3
- data/lib/native-package-installer/platform/fedora.rb +3 -2
- data/lib/native-package-installer/platform/freebsd.rb +1 -1
- data/lib/native-package-installer/platform/homebrew.rb +1 -1
- data/lib/native-package-installer/platform/macports.rb +1 -1
- data/lib/native-package-installer/platform/msys2.rb +4 -2
- data/lib/native-package-installer/platform/pld-linux.rb +1 -1
- data/lib/native-package-installer/platform/redhat.rb +4 -3
- data/lib/native-package-installer/platform/suse.rb +3 -2
- data/{test/run-test.rb → lib/native-package-installer/platform/ubuntu.rb} +25 -7
- data/lib/native-package-installer/platform/unknown.rb +1 -1
- data/lib/native-package-installer/platform.rb +31 -17
- data/lib/native-package-installer/version.rb +2 -2
- data/lib/native-package-installer.rb +6 -4
- metadata +7 -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: 68135b343f8f097ab9d5905665f95d7a6c7b4deb8da945ccd47c0eed1f1156ba
|
4
|
+
data.tar.gz: 14bfb527c6bb3d0c4937d2f006e19560d4d36a612b577f1e8093f27f21190c60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d039cc554f6faeb998243befd314030beb4a5b5cffe7c01ccdcefc66d41458292dd7432b4ae7899297f2338b630adb75730184e9f9726f4558bea16bb06fb6b7
|
7
|
+
data.tar.gz: efd8b4e759b7b195d9b0bf7a81645f28e8575c3aa1747333cced3ceac9fc980e3ed55b30e205bd409a4616e92a5562391dfe608bb3b13ee77153625242e02d36
|
data/README.md
CHANGED
@@ -1,9 +1,16 @@
|
|
1
|
-
#
|
1
|
+
# native-package-installer
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/native-package-installer.svg)](https://badge.fury.io/rb/native-package-installer)
|
4
|
+
|
5
|
+
Users need to install native packages to install an extension library
|
6
|
+
that depends on native packages. It bores users because users need to
|
7
|
+
install native packages and an extension library separately.
|
8
|
+
native-package-installer helps to install native packages on "gem install".
|
9
|
+
Users can install both native packages and an extension library by one action,
|
10
|
+
"gem install".
|
4
11
|
|
5
12
|
## License
|
6
13
|
|
7
|
-
Copyright (C) 2013-
|
14
|
+
Copyright (C) 2013-2020 Ruby-GNOME Project Team
|
8
15
|
|
9
16
|
LGPL-3 or later. See doc/text/lgpl-3.txt for details.
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2013 Ruby-
|
3
|
+
# Copyright (C) 2013 Ruby-GNOME Project Team
|
4
4
|
#
|
5
5
|
# This library is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published by
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,54 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 1.1.3 - 2022-01-18
|
4
|
+
|
5
|
+
### Fixes
|
6
|
+
|
7
|
+
* Fixed wrong package install on Windows.
|
8
|
+
|
9
|
+
## 1.1.2 - 2022-01-18
|
10
|
+
|
11
|
+
### Improvements
|
12
|
+
|
13
|
+
* Changed priority for Homebrew on Linux. System package manager is preferred.
|
14
|
+
|
15
|
+
* Improved OpenSuSE detection.
|
16
|
+
|
17
|
+
* Added support for Ruby 3.1 based RubyInstaller.
|
18
|
+
|
19
|
+
## 1.1.1 - 2021-01-17
|
20
|
+
|
21
|
+
### Improvements
|
22
|
+
|
23
|
+
* [CentOS 8] Followed the powertools repository name change.
|
24
|
+
|
25
|
+
## 1.1.0 - 2020-04-12
|
26
|
+
|
27
|
+
### Improvements
|
28
|
+
|
29
|
+
* Updated README.
|
30
|
+
[GitHub#11][Patch by kojix2]
|
31
|
+
|
32
|
+
* Added support for Raspbian.
|
33
|
+
[GitHub#12][Patch by xetum]
|
34
|
+
|
35
|
+
### Thanks
|
36
|
+
|
37
|
+
* kojix2
|
38
|
+
|
39
|
+
* xetum
|
40
|
+
|
41
|
+
## 1.0.9 - 2019-12-10
|
42
|
+
|
43
|
+
### Improvements
|
44
|
+
|
45
|
+
* Added support for Ubuntu specific package.
|
46
|
+
[GitHub#9][Patch by İsmail Arılık]
|
47
|
+
|
48
|
+
### Thanks
|
49
|
+
|
50
|
+
* İsmail Arılık
|
51
|
+
|
3
52
|
## 1.0.8 - 2019-10-10
|
4
53
|
|
5
54
|
### 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-
|
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 Ruby-
|
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,7 +20,14 @@ class NativePackageInstaller
|
|
20
20
|
|
21
21
|
class << self
|
22
22
|
def current_platform?
|
23
|
-
|
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")
|
29
|
+
end
|
30
|
+
false
|
24
31
|
end
|
25
32
|
end
|
26
33
|
|
@@ -29,7 +36,7 @@ class NativePackageInstaller
|
|
29
36
|
end
|
30
37
|
|
31
38
|
def install_command
|
32
|
-
"apt install -V -y"
|
39
|
+
"apt-get install -V -y"
|
33
40
|
end
|
34
41
|
|
35
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
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2017-2019 Ruby-
|
1
|
+
# Copyright (C) 2017-2019 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
|
@@ -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
|
|
@@ -30,7 +31,7 @@ class NativePackageInstaller
|
|
30
31
|
|
31
32
|
def install_command
|
32
33
|
if major_version >= 8
|
33
|
-
"dnf install --enablerepo=
|
34
|
+
"dnf install --enablerepo=powertools -y"
|
34
35
|
else
|
35
36
|
"yum install -y"
|
36
37
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2017 Ruby-
|
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,6 +1,4 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2021 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,29 @@
|
|
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 "debian"
|
17
|
+
|
18
|
+
class NativePackageInstaller
|
19
|
+
module Platform
|
20
|
+
class Ubuntu < Debian
|
21
|
+
Platform.register(self)
|
19
22
|
|
20
|
-
|
21
|
-
|
23
|
+
class << self
|
24
|
+
def current_platform?
|
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")
|
31
|
+
end
|
32
|
+
false
|
33
|
+
end
|
34
|
+
end
|
22
35
|
|
23
|
-
|
36
|
+
def package(spec)
|
37
|
+
spec[:ubuntu] || spec[:debian]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2017 Ruby-
|
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,30 +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
|
+
# macOS
|
37
|
+
require_relative "platform/macports"
|
39
38
|
|
40
|
-
|
41
|
-
require "native-package-installer/platform/fedora"
|
42
|
-
require "native-package-installer/platform/redhat"
|
43
|
-
require "native-package-installer/platform/suse"
|
44
|
-
require "native-package-installer/platform/alt-linux"
|
45
|
-
require "native-package-installer/platform/arch-linux"
|
46
|
-
require "native-package-installer/platform/pld-linux"
|
39
|
+
require_relative "platform/homebrew"
|
47
40
|
|
48
|
-
require "native-package-installer/platform/homebrew"
|
49
41
|
|
50
|
-
|
42
|
+
# FreeBSD
|
43
|
+
require_relative "platform/freebsd"
|
51
44
|
|
52
|
-
|
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/redhat"
|
56
|
+
require_relative "platform/fedora"
|
57
|
+
|
58
|
+
require_relative "platform/suse"
|
59
|
+
|
60
|
+
|
61
|
+
# Windows
|
62
|
+
require_relative "platform/msys2"
|
63
|
+
|
64
|
+
|
65
|
+
# Fallback
|
66
|
+
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.
|
17
|
+
VERSION = "1.1.3"
|
18
18
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2017 Ruby-
|
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.
|
4
|
+
version: 1.1.3
|
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-01-18 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,6 +31,7 @@ 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
|
78
37
|
- lib/native-package-installer/platform/arch-linux.rb
|
@@ -85,10 +44,9 @@ files:
|
|
85
44
|
- lib/native-package-installer/platform/pld-linux.rb
|
86
45
|
- lib/native-package-installer/platform/redhat.rb
|
87
46
|
- lib/native-package-installer/platform/suse.rb
|
47
|
+
- lib/native-package-installer/platform/ubuntu.rb
|
88
48
|
- lib/native-package-installer/platform/unknown.rb
|
89
49
|
- lib/native-package-installer/version.rb
|
90
|
-
- test/run-test.rb
|
91
|
-
- test/test-executable-finder.rb
|
92
50
|
homepage: https://github.com/ruby-gnome/native-package-installer
|
93
51
|
licenses:
|
94
52
|
- LGPL-3+
|
@@ -108,11 +66,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
66
|
- !ruby/object:Gem::Version
|
109
67
|
version: '0'
|
110
68
|
requirements: []
|
111
|
-
|
112
|
-
rubygems_version: 2.7.6.2
|
69
|
+
rubygems_version: 3.4.0.dev
|
113
70
|
signing_key:
|
114
71
|
specification_version: 4
|
115
72
|
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
|
73
|
+
test_files: []
|
@@ -1,90 +0,0 @@
|
|
1
|
-
# Copyright (C) 2013 Ruby-GNOME2 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
|