upm 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/upm/tool.rb +15 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d901b8aceeac1eb343486a67392bffbc3935f01c987f82419c77e7a2ec92315f
|
4
|
+
data.tar.gz: 22b98cda2762df2182f5e44e29f553ffc994a9e51d46a2adfca090981eaf6c88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64cd20e668acb406d5bb43d2a830433e2c5c2042bee2fcfaaf4c027caed6b15f5d04cba91b9cf53009570d37741358b61966cc85fe4fbdec9ca0aff67ccfa8c9
|
7
|
+
data.tar.gz: 941dc0e11840557a412db511fb05d50fd675059345f365a66c35dcf946f96e9f6c4b18ad0b47fb3eb7b1c940ff8c8fdaa4b4f6e7dd2d00863256508e98d08ee3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/upm/tool.rb
CHANGED
@@ -62,17 +62,28 @@ module UPM
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def self.nice_os_name
|
65
|
-
os_release.values_at("PRETTY_NAME", "NAME", "ID", "ID_LIKE").first
|
65
|
+
os_release.values_at("PRETTY_NAME", "NAME", "ID", "ID_LIKE").first ||
|
66
|
+
(`uname -o`.chomp rescue nil)
|
66
67
|
end
|
67
68
|
|
68
69
|
def self.for_os(os_names=nil)
|
69
70
|
os_names = os_names ? [os_names].flatten : current_os_names
|
70
71
|
|
72
|
+
tool = nil
|
73
|
+
|
71
74
|
if os_names.any?
|
72
|
-
@@tools.find { |name, tool| os_names.any? { |name| tool.os.include? name } }.last
|
73
|
-
|
74
|
-
|
75
|
+
tool = @@tools.find { |name, tool| os_names.any? { |name| tool.os.include? name } }.last
|
76
|
+
end
|
77
|
+
|
78
|
+
if tool.nil?
|
79
|
+
tool = @@tools.find { |name, tool| File.which(tool.identifying_binary) }.last
|
75
80
|
end
|
81
|
+
|
82
|
+
if tool.nil?
|
83
|
+
puts "Error: couldn't find a package manager."
|
84
|
+
end
|
85
|
+
|
86
|
+
tool
|
76
87
|
end
|
77
88
|
|
78
89
|
###################################################################
|