scoobydoo 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/scoobydoo.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3ee58587459176b289e5d3e17f09be6b0b4f466
|
4
|
+
data.tar.gz: 476567fae7d105db1cf7ab823997e5179e80942b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c7d4cd7c5ab994e31b9c707009aad681f6b347f15965dc4e0ea69b3d1443dffa6ebdefce6eb0a33c9e90f0cbb283ac9ed3528b0b001f4b9d54f36724393fc80
|
7
|
+
data.tar.gz: 0ef48f15d55e92b283fe2cf778fae85a7536702bcb43c47184be485d6ba84e51379b8e1c9c0572a9c86f530cf1bf89c439a05a18fb52deba77074e2d093ae505
|
data/lib/scoobydoo.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
require "pathname"
|
2
2
|
|
3
3
|
class ScoobyDoo
|
4
|
+
@@cache = Hash.new
|
5
|
+
|
4
6
|
def self.where_are_you(cmd)
|
7
|
+
if (@@cache.has_key?(cmd))
|
8
|
+
return @@cache[cmd]
|
9
|
+
end
|
10
|
+
|
5
11
|
if (cmd.include?(File::PATH_SEPARATOR))
|
6
12
|
exe = Pathname.new(cmd).expand_path
|
7
13
|
return (exe.executable? && !exe.directory?) ? exe : nil
|
@@ -12,6 +18,7 @@ class ScoobyDoo
|
|
12
18
|
exts.each do |ext|
|
13
19
|
exe = File.join(path, "#{cmd}#{ext}")
|
14
20
|
if (File.executable?(exe) && !File.directory?(exe))
|
21
|
+
@@cache[cmd] = exe
|
15
22
|
return exe
|
16
23
|
end
|
17
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scoobydoo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Whittaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Cross-platform which for ruby.
|
14
14
|
email: mjwhitta@gmail.com
|