wicked_witch 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/wicked_witch.rb +7 -3
  2. 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
- return exe if File.executable? exe
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
- paths = ENV['PATH'].split File::PATH_SEPARATOR
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wicked_witch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: