load_path_find 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +11 -1
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/load_path_find.rb +10 -0
- data/spec/load_path_find_spec.rb +10 -0
- metadata +12 -3
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Load Path Find
|
2
2
|
|
3
|
-
Useful tools for looking for files on the
|
3
|
+
Useful tools for looking for files on the <tt>$LOAD_PATH</tt>
|
4
4
|
|
5
5
|
== Usage
|
6
6
|
|
@@ -15,3 +15,13 @@ Useful tools for looking for files on the $LOAD_PATH
|
|
15
15
|
And you'll get an array of matches.
|
16
16
|
|
17
17
|
> $LOAD_PATH.find_all_files('../spec') {|file| puts "here is a spec! #{file}"}
|
18
|
+
|
19
|
+
And now, even more awesome!
|
20
|
+
|
21
|
+
> $LOAD_PATH.add_current
|
22
|
+
|
23
|
+
.. adds the current path to your <tt>$LOAD_PATH</tt> and.
|
24
|
+
|
25
|
+
> $LOAD_PATH.add_current!
|
26
|
+
|
27
|
+
.. adds the current path to the start of the <tt>$LOAD_PATH</tt>
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/load_path_find.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'dirge'
|
2
|
+
|
1
3
|
$LOAD_PATH.instance_eval do
|
2
4
|
def find_file(file)
|
3
5
|
find_all_files(file){|f| return f}
|
@@ -15,4 +17,12 @@ $LOAD_PATH.instance_eval do
|
|
15
17
|
}
|
16
18
|
end
|
17
19
|
|
20
|
+
def add_current
|
21
|
+
self << __DIR_REL__(caller.first)
|
22
|
+
end
|
23
|
+
|
24
|
+
def add_current!
|
25
|
+
self.unshift(__DIR_REL__(caller.first))
|
26
|
+
end
|
27
|
+
|
18
28
|
end
|
data/spec/load_path_find_spec.rb
CHANGED
@@ -35,5 +35,15 @@ describe 'load path find' do
|
|
35
35
|
mock.should_receive(:hello).exactly(2).times
|
36
36
|
$:.find_all_files(target) { mock.hello }
|
37
37
|
end
|
38
|
+
|
39
|
+
it "should add the current path" do
|
40
|
+
$LOAD_PATH.add_current
|
41
|
+
$LOAD_PATH.last.should == __DIR__
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should add the current path to the start" do
|
45
|
+
$LOAD_PATH.add_current!
|
46
|
+
$LOAD_PATH.first.should == __DIR__
|
47
|
+
end
|
38
48
|
|
39
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: load_path_find
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Hull
|
@@ -11,8 +11,17 @@ cert_chain: []
|
|
11
11
|
|
12
12
|
date: 2010-01-16 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: dirge
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.3
|
24
|
+
version:
|
16
25
|
description: Convenient way to find stuff on the load path.
|
17
26
|
email: joshbuddy@gmail.com
|
18
27
|
executables: []
|