native-package-installer 1.0.1 → 1.0.2

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
  SHA1:
3
- metadata.gz: 6787655da3e53dd28304ac2a6e41f0bac54615d0
4
- data.tar.gz: 42101e7d1d488adc27ea597c38cf533d9ac3b06f
3
+ metadata.gz: b6e3c5da042003709458a9887de63c2168ebd7f5
4
+ data.tar.gz: fe1f9f8e3ca5ae08564d39532407ef04e89e5658
5
5
  SHA512:
6
- metadata.gz: 7da03fb0cf1988b3af75b1ddc042c5d1fd7d160e2992d78623c7cbc1801d0b84533e2be4c86305abde20bf1640ea7cb6529083b40ed16700689d1fba45cf0f5d
7
- data.tar.gz: 317ecbb09eb80d8e14ad25b342142404c448871dbc185e44d97b47dd6be999b8fe2bf262f54d37ca800519bf66bcf873cc90ef6216a8a5734b475f69d18dbf24
6
+ metadata.gz: e32b604008cb25c60a6e90dc4af8947bc17bcf35c4a6e0af52275187c1ecbf6cb0c2db4f8584cc616e6f6e07906df0a0ebe145d8d83a4519110141d6febf1e55
7
+ data.tar.gz: ee23905ddab477cd13347f652cb0bb1ad2d51daa9fe4cf9dbd4993d51327dd35057775d4c059ccfcd3d76419353ce10ed6ed8059b8084a8a3e39277ceb79f4c3
@@ -1,5 +1,22 @@
1
1
  # News
2
2
 
3
+ ## 1.0.2 - 2017-05-29
4
+
5
+ ### Improvements
6
+
7
+ * Supported DNF on Fedora.
8
+ [GitHub#3][Reported by Vít Ondruch]
9
+
10
+ * Supported MSYS2.
11
+
12
+ ### Fixes
13
+
14
+ * Fixed broken messages.
15
+
16
+ ### Thanks
17
+
18
+ * Vít Ondruch
19
+
3
20
  ## 1.0.1 - 2017-05-03
4
21
 
5
22
  ### Improvements
@@ -33,8 +33,6 @@ class NativePackageInstaller
33
33
  end
34
34
 
35
35
  def install
36
- return true if windows?
37
-
38
36
  package = @platform.package(@spec)
39
37
  return false if package.nil?
40
38
 
@@ -79,13 +77,13 @@ class NativePackageInstaller
79
77
  unless succeeded
80
78
  if failed_to_get_super_user_priviledge
81
79
  error_message = <<-MESSAGE
82
- {package_name}' native package is required.
83
- n the following command as super user to install required native package:
84
- \# #{install_command}
80
+ '#{package_name}' native package is required.
81
+ Run the following command as super user to install required native package:
82
+ \# #{install_command}
85
83
  MESSAGE
86
84
  else
87
85
  error_message = <<-MESSAGE
88
- iled to run '#{install_command}'.
86
+ Failed to run '#{install_command}'.
89
87
  MESSAGE
90
88
  end
91
89
  end
@@ -100,10 +98,6 @@ iled to run '#{install_command}'.
100
98
  end
101
99
 
102
100
  private
103
- def windows?
104
- /mswin|mingw|cygwin/ === RUBY_PLATFORM
105
- end
106
-
107
101
  def super_user?
108
102
  Process.uid.zero?
109
103
  end
@@ -29,6 +29,7 @@ class NativePackageInstaller
29
29
 
30
30
  def initialize(basename)
31
31
  @basename = basename
32
+ @appended_paths = []
32
33
  end
33
34
 
34
35
  def find
@@ -50,14 +51,19 @@ class NativePackageInstaller
50
51
  not find.nil?
51
52
  end
52
53
 
54
+ def append_path(path)
55
+ @appended_paths << path
56
+ end
57
+
53
58
  private
54
59
  def paths
55
60
  path_env = ENV["PATH"]
56
61
  if path_env
57
- path_env.split(File::PATH_SEPARATOR)
62
+ base_paths = path_env.split(File::PATH_SEPARATOR)
58
63
  else
59
- ["/usr/local/bin", "/usr/bin", "/bin"]
64
+ base_paths = ["/usr/local/bin", "/usr/bin", "/bin"]
60
65
  end
66
+ base_paths + @appended_paths
61
67
  end
62
68
 
63
69
  def detect_extensions
@@ -42,4 +42,5 @@ require "native-package-installer/platform/alt-linux"
42
42
  require "native-package-installer/platform/arch-linux"
43
43
  require "native-package-installer/platform/homebrew"
44
44
  require "native-package-installer/platform/macports"
45
+ require "native-package-installer/platform/msys2"
45
46
  require "native-package-installer/platform/unknown"
@@ -13,11 +13,9 @@
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/redhat"
17
-
18
16
  class NativePackageInstaller
19
17
  module Platform
20
- class Fedora < RedHat
18
+ class Fedora
21
19
  Platform.register(self)
22
20
 
23
21
  class << self
@@ -27,7 +25,15 @@ class NativePackageInstaller
27
25
  end
28
26
 
29
27
  def package(spec)
30
- spec[:fedora] || super
28
+ spec[:fedora] || spec[:rehat]
29
+ end
30
+
31
+ def install_command
32
+ "dnf install -y"
33
+ end
34
+
35
+ def need_super_user_priviledge?
36
+ true
31
37
  end
32
38
  end
33
39
  end
@@ -0,0 +1,70 @@
1
+ # Copyright (C) 2017 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
+ class NativePackageInstaller
17
+ module Platform
18
+ class MSYS2
19
+ Platform.register(self)
20
+
21
+ class << self
22
+ def current_platform?
23
+ return false if package_prefix.nil?
24
+ not pacman_path.nil?
25
+ end
26
+
27
+ def pacman_path
28
+ finder = ExecutableFinder.new("pacman")
29
+ case RUBY_PLATFORM
30
+ when "x86-mingw32"
31
+ Dir.glob("c:/msys{64,32,*}/usr/bin") do |bin|
32
+ finder.append_path(bin)
33
+ end
34
+ when "x64-mingw32"
35
+ Dir.glob("c:/msys{64,*}/usr/bin") do |bin|
36
+ finder.append_path(bin)
37
+ end
38
+ end
39
+ finder.find
40
+ end
41
+
42
+ def package_prefix
43
+ case RUBY_PLATFORM
44
+ when "x86-mingw32"
45
+ "mingw-w64-i686-"
46
+ when "x64-mingw32"
47
+ "mingw-w64-x86_64-"
48
+ else
49
+ nil
50
+ end
51
+ end
52
+ end
53
+
54
+ def package(spec)
55
+ base_name = spec[:msys2]
56
+ return nil if base_name.nil?
57
+
58
+ "#{self.class.package_prefix}#{base_name}"
59
+ end
60
+
61
+ def install_command
62
+ "#{self.class.pacman_path} -S --noconfirm"
63
+ end
64
+
65
+ def need_super_user_priviledge?
66
+ false
67
+ end
68
+ end
69
+ end
70
+ end
@@ -28,7 +28,6 @@ class NativePackageInstaller
28
28
  spec[:redhat]
29
29
  end
30
30
 
31
-
32
31
  def install_command
33
32
  "yum install -y"
34
33
  end
@@ -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.0.1"
17
+ VERSION = "1.0.2"
18
18
  end
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.0.1
4
+ version: 1.0.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: 2017-05-03 00:00:00.000000000 Z
11
+ date: 2017-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,6 +95,7 @@ files:
95
95
  - lib/native-package-installer/platform/freebsd.rb
96
96
  - lib/native-package-installer/platform/homebrew.rb
97
97
  - lib/native-package-installer/platform/macports.rb
98
+ - lib/native-package-installer/platform/msys2.rb
98
99
  - lib/native-package-installer/platform/redhat.rb
99
100
  - lib/native-package-installer/platform/suse.rb
100
101
  - lib/native-package-installer/platform/unknown.rb