wicked_witch 0.0.1
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/bin/wwitch.rb +2 -0
- data/lib/wicked_witch.rb +32 -0
- metadata +50 -0
data/bin/wwitch.rb
ADDED
data/lib/wicked_witch.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module WickedWitch
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def [](name)
|
7
|
+
which name
|
8
|
+
end
|
9
|
+
|
10
|
+
def which(name)
|
11
|
+
paths.each do |path|
|
12
|
+
extensions.each do |ext|
|
13
|
+
exe = File.join path, name + ext
|
14
|
+
return exe if File.executable? exe
|
15
|
+
end
|
16
|
+
end
|
17
|
+
nil
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def paths
|
23
|
+
paths = ENV['PATH'].split File::PATH_SEPARATOR
|
24
|
+
paths.map { |p| Pathname.new(p).realpath }
|
25
|
+
end
|
26
|
+
|
27
|
+
def extensions
|
28
|
+
pathext = ENV['PATHEXT'].to_s.split ';'
|
29
|
+
pathext.empty? ? [''] : pathext
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wicked_witch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Matthew Riley
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-08-02 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Finds executables on the PATH. Cross-platform equivalent of the UNIX
|
15
|
+
"which" command.
|
16
|
+
email: matthew@matthewriley.name
|
17
|
+
executables:
|
18
|
+
- wwitch.rb
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- lib/wicked_witch.rb
|
23
|
+
- !binary |-
|
24
|
+
YmluL3d3aXRjaC5yYg==
|
25
|
+
homepage: http://rubygems.org/gems/wicked_witch
|
26
|
+
licenses: []
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
none: false
|
33
|
+
requirements:
|
34
|
+
- - ! '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubyforge_project:
|
45
|
+
rubygems_version: 1.8.15
|
46
|
+
signing_key:
|
47
|
+
specification_version: 3
|
48
|
+
summary: Finds executables on the PATH. Cross-platform equivalent of the UNIX "which"
|
49
|
+
command.
|
50
|
+
test_files: []
|