shellopts 2.9.1 → 2.9.3
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/lib/shellopts/version.rb +1 -1
- data/lib/shellopts.rb +22 -2
- 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: 1950cbdae4c3684da6d66344b0bac62d95c1b50f3ed4b7aeefce03ba5122453d
|
|
4
|
+
data.tar.gz: 0b0c97f2bb79d1d8aa43f9e459a8eb9d1e0ce8029fdbd98cfd6531c98c5b666b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 61655f86f2d50206c3d9ccc1df6f160408b92a2fe8c38191d22f7c76b92e358b0012880243fad9e72e95521af7bddf6950636a3213eb2ef302af4324648908a0
|
|
7
|
+
data.tar.gz: ca57276481f59f281e3ecec1f3e45700578354a7e4e9f4e5b08fe5bf2a96a7c00b3ecec5ffd5438538b008a76100580461ebf10aa4a435d08e894a49e2842ca8
|
data/lib/shellopts/version.rb
CHANGED
data/lib/shellopts.rb
CHANGED
|
@@ -135,6 +135,7 @@ module ShellOpts
|
|
|
135
135
|
|
|
136
136
|
# Use exceptions instead of ShellOpts's error methods. Default is
|
|
137
137
|
# ShellOpts.exception that itself defalts to false. Mostly used for debug
|
|
138
|
+
# when you want a stack trace instead of a user-readable error message
|
|
138
139
|
attr_accessor :exception
|
|
139
140
|
|
|
140
141
|
# Debug: Internal variables made public
|
|
@@ -243,8 +244,7 @@ module ShellOpts
|
|
|
243
244
|
self
|
|
244
245
|
end
|
|
245
246
|
|
|
246
|
-
# Compile +spec+ and interpret +argv+. Returns a
|
|
247
|
-
# ShellOpts::Program and ShellOpts::Args object
|
|
247
|
+
# Compile +spec+ and interpret +argv+. Returns a ShellOpts object
|
|
248
248
|
#
|
|
249
249
|
def process(spec, argv)
|
|
250
250
|
compile(spec)
|
|
@@ -317,6 +317,26 @@ module ShellOpts
|
|
|
317
317
|
IO.readlines(version_rb).grep(/^.*VERSION\s*=\s*"(.*?)".*$/) { $1 }.first
|
|
318
318
|
end
|
|
319
319
|
|
|
320
|
+
def find_version_number
|
|
321
|
+
# Uninstalled program called using 'bundle exec'
|
|
322
|
+
if version_rb = Dir.glob(File.dirname(file) + "/../lib/*/version.rb").first
|
|
323
|
+
version = IO.readlines(version_rb).grep(/^.*VERSION\s*=\s*"(.*?)".*$/) { $1 }.first
|
|
324
|
+
|
|
325
|
+
# Installed program
|
|
326
|
+
elsif spec = Gem::Specification.find_by_path($0)
|
|
327
|
+
version = spec.version.to_s
|
|
328
|
+
|
|
329
|
+
# Installed program using RVM wrappers
|
|
330
|
+
else
|
|
331
|
+
spec = Gem::Specification.find_all
|
|
332
|
+
.select { |s| s.executables.include?(File.basename($0)) }
|
|
333
|
+
.max_by { |s| s.version }
|
|
334
|
+
version = spec&.version.to_s
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
version
|
|
338
|
+
end
|
|
339
|
+
|
|
320
340
|
def handle_exceptions(&block)
|
|
321
341
|
return yield if ::ShellOpts.exception
|
|
322
342
|
begin
|