whichr 0.1.9 → 0.2.0

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/whichr.rb +5 -5
  2. metadata +12 -2
data/lib/whichr.rb CHANGED
@@ -10,7 +10,7 @@ class RubyWhich
10
10
  def which( names, return_non_executables_too = false )
11
11
  names = [names] unless names.is_a? Array
12
12
 
13
- if RUBY_PLATFORM =~ /mswin|mingw/
13
+ if OS.windows?
14
14
  for name in names.dup # avoid recursion
15
15
  # windows compat.
16
16
  for extension in ENV['PATHEXT'].split(';') do
@@ -22,10 +22,10 @@ class RubyWhich
22
22
  all_found = []
23
23
  path = ENV['PATH']
24
24
  # on windows add . [the cwd]
25
- path += (File::PATH_SEPARATOR + '.') if RUBY_PLATFORM =~ /mswin|mingw/
25
+ path += (File::PATH_SEPARATOR + '.') if OS.windows?
26
26
  path.split(File::PATH_SEPARATOR).each do |dir|
27
27
  for name in names
28
- if RUBY_PLATFORM =~ /mswin|mingw/
28
+ if OS.windows?
29
29
  names2 = Dir.glob(dir.gsub("\\", "/") + '/' + name.strip)
30
30
  unless return_non_executables_too
31
31
  names2 = names2.select{|name| File.executable?(name)} # only real execs
@@ -40,7 +40,7 @@ class RubyWhich
40
40
  end
41
41
 
42
42
  # parse out same spelled fellas in doze
43
- if RUBY_PLATFORM =~ /mswin|mingw/
43
+ if OS.windows?
44
44
  unique = []
45
45
  previous = {}
46
46
  all_found.each {|entry|
@@ -71,7 +71,7 @@ class RubyWhich
71
71
  output = "higher in the list is executed first\n"
72
72
  for candidate in all
73
73
  # might just match the name and not be executable
74
- candidate = Dir.glob(candidate + '*')[0] if RUBY_PLATFORM =~ /mswin|mingw/ # get the right capitalization in doze
74
+ candidate = Dir.glob(candidate + '*')[0] if OS.windows?
75
75
  output << candidate
76
76
  if !File.executable? candidate
77
77
  output += ' (is not executable)'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whichr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger Pack
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-29 00:00:00 -06:00
12
+ date: 2009-11-03 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,6 +22,16 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 2.3.0
24
24
  version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: sane
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
25
35
  description: windows friendly which command
26
36
  email:
27
37
  - rogerdpack@gmail.comm