wicked_witch 0.0.2 → 0.0.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.
- data/lib/wicked_witch.rb +7 -3
- metadata +1 -1
data/lib/wicked_witch.rb
CHANGED
@@ -11,7 +11,8 @@ module WickedWitch
|
|
11
11
|
paths.each do |path|
|
12
12
|
extensions.each do |ext|
|
13
13
|
exe = File.join path, name + ext
|
14
|
-
|
14
|
+
real_exe = real_path exe
|
15
|
+
return real_exe if real_exe && File.executable?(real_exe)
|
15
16
|
end
|
16
17
|
end
|
17
18
|
nil
|
@@ -20,8 +21,7 @@ module WickedWitch
|
|
20
21
|
private
|
21
22
|
|
22
23
|
def paths
|
23
|
-
|
24
|
-
paths.map { |p| Pathname.new(p).realpath }
|
24
|
+
ENV['PATH'].split File::PATH_SEPARATOR
|
25
25
|
end
|
26
26
|
|
27
27
|
def extensions
|
@@ -29,4 +29,8 @@ module WickedWitch
|
|
29
29
|
pathext.empty? ? [''] : pathext
|
30
30
|
end
|
31
31
|
|
32
|
+
def real_path(exe)
|
33
|
+
Pathname.new(exe).realpath.to_s if File.exist? exe
|
34
|
+
end
|
35
|
+
|
32
36
|
end
|