Skip to content

Commit

Permalink
update for jruby
Browse files Browse the repository at this point in the history
  • Loading branch information
rdp committed Nov 4, 2009
1 parent 65de1a3 commit 88ec75a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 5 additions & 5 deletions lib/whichr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class RubyWhich
def which( names, return_non_executables_too = false )
names = [names] unless names.is_a? Array

if RUBY_PLATFORM =~ /mswin|mingw/
if OS.windows?
for name in names.dup # avoid recursion
# windows compat.
for extension in ENV['PATHEXT'].split(';') do
Expand All @@ -22,10 +22,10 @@ def which( names, return_non_executables_too = false )
all_found = []
path = ENV['PATH']
# on windows add . [the cwd]
path += (File::PATH_SEPARATOR + '.') if RUBY_PLATFORM =~ /mswin|mingw/
path += (File::PATH_SEPARATOR + '.') if OS.windows?
path.split(File::PATH_SEPARATOR).each do |dir|
for name in names
if RUBY_PLATFORM =~ /mswin|mingw/
if OS.windows?
names2 = Dir.glob(dir.gsub("\\", "/") + '/' + name.strip)
unless return_non_executables_too
names2 = names2.select{|name| File.executable?(name)} # only real execs
Expand All @@ -40,7 +40,7 @@ def which( names, return_non_executables_too = false )
end

# parse out same spelled fellas in doze
if RUBY_PLATFORM =~ /mswin|mingw/
if OS.windows?
unique = []
previous = {}
all_found.each {|entry|
Expand Down Expand Up @@ -71,7 +71,7 @@ def output all
output = "higher in the list is executed first\n"
for candidate in all
# might just match the name and not be executable
candidate = Dir.glob(candidate + '*')[0] if RUBY_PLATFORM =~ /mswin|mingw/ # get the right capitalization in doze
candidate = Dir.glob(candidate + '*')[0] if OS.windows?
output << candidate
if !File.executable? candidate
output += ' (is not executable)'
Expand Down
6 changes: 2 additions & 4 deletions whichr.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = %q{whichr}
s.version = "0.1.9"
s.version = "0.2.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Roger Pack"]
Expand All @@ -11,9 +11,7 @@ Gem::Specification.new do |s|
s.executable = 'whichr'
s.require_paths = ["lib"]
s.add_dependency(%q<rdoc>, [">= 2.3.0"]) # so that I don't need a lib directory :P
# s.add_dependency(%q<rogerdpack-sane>) # Object.in?


s.add_dependency(%q<sane>) # Object.in?

# 0.1.0 initial release happy birthday
# 0.1.1 bump README
Expand Down

0 comments on commit 88ec75a

Please sign in to comment.