upm 0.1.3 → 0.1.5

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/upm/tool.rb +15 -4
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34ab54fc955906c85199e43735991d297f7db20e2f78a53c49ae22ce08ddd30f
4
- data.tar.gz: 123c3e08566179a36f32ed0cb4e304a72eb75f785ce128bd1b8959c3d7ca78c2
3
+ metadata.gz: d901b8aceeac1eb343486a67392bffbc3935f01c987f82419c77e7a2ec92315f
4
+ data.tar.gz: 22b98cda2762df2182f5e44e29f553ffc994a9e51d46a2adfca090981eaf6c88
5
5
  SHA512:
6
- metadata.gz: 723b556018ce78091e5a9bf6b6132a3a730707b40bbc6db98377441e0c7ef7cfd4e164a841b750379805a136c4477e5059377af81da5c3402edf7290d31f11c1
7
- data.tar.gz: ea06d30b45f4624637cd515dc400d909462b7022e92bf961c7191fda601f272a80bdfa1589370d3118a1ca5f039e879773be25b964cfef0d07182225e78247b9
6
+ metadata.gz: 64cd20e668acb406d5bb43d2a830433e2c5c2042bee2fcfaaf4c027caed6b15f5d04cba91b9cf53009570d37741358b61966cc85fe4fbdec9ca0aff67ccfa8c9
7
+ data.tar.gz: 941dc0e11840557a412db511fb05d50fd675059345f365a66c35dcf946f96e9f6c4b18ad0b47fb3eb7b1c940ff8c8fdaa4b4f6e7dd2d00863256508e98d08ee3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
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
- else
74
- @@tools.find { |name, tool| File.which(tool.identifying_binary) }.last
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
  ###################################################################
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - epitron