rogerdpack-which_ruby 0.0.2

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.
Files changed (2) hide show
  1. data/bin/which_ruby +39 -0
  2. metadata +74 -0
data/bin/which_ruby ADDED
@@ -0,0 +1,39 @@
1
+ # stolen from the gnuplot gem
2
+ # and then modified
3
+ require 'sane'
4
+
5
+ if(ARGV[0].in?( ['-h', '--help'])) || !ARGV[0]
6
+ puts 'syntax: binary_name'
7
+ else
8
+ puts 'higher in the list will be executed first'
9
+ def which ( bin )
10
+ success = false
11
+ path = '.' + File::PATH_SEPARATOR + ENV['PATH']
12
+
13
+ path.split(File::PATH_SEPARATOR).each do |dir|
14
+ candidates = Dir.glob (dir.gsub("\\", "/") + '/' + bin.strip)
15
+ for candidate in candidates
16
+ if File::executable? candidate
17
+ puts candidate
18
+ success = true
19
+ elsif File::exist? candidate
20
+ puts candidate + ' is not executable'
21
+ end
22
+ end
23
+ end
24
+
25
+ # This is an implementation that works when the which command is
26
+ # available.
27
+ #
28
+ # IO.popen("which #{bin}") { |io| return io.readline.chomp }
29
+
30
+ return success
31
+ end
32
+ answer = which(ARGV[0])
33
+ # windows compat.
34
+ if !answer and RUBY_PLATFORM =~ /mswin|mingw/
35
+ which(ARGV[0] + '.exe')
36
+ which(ARGV[0] + '.bat')
37
+ which(ARGV[0] + '.cmd')
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rogerdpack-which_ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Roger Pack
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-16 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rdoc
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.3.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rogerdpack-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:
35
+ description: windows friendly which command
36
+ email:
37
+ - rogerdpack@gmail.comm
38
+ executables:
39
+ - which_ruby
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - bin/which_ruby
46
+ has_rdoc: false
47
+ homepage: http://github.com/rogerdpack/which_ruby
48
+ licenses:
49
+ post_install_message:
50
+ rdoc_options: []
51
+
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ version:
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ version:
66
+ requirements: []
67
+
68
+ rubyforge_project:
69
+ rubygems_version: 1.3.5
70
+ signing_key:
71
+ specification_version: 2
72
+ summary: windows friendly which command
73
+ test_files: []
74
+