load_path_find 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,19 @@
2
2
 
3
3
  Useful tools for looking for files on the <tt>$LOAD_PATH</tt>
4
4
 
5
+ ==DEPRECATED
6
+
7
+ This library is no longer maintained. Everything it does and so much more is now provided by
8
+ http://github.com/joshbuddy/callsite. To get back load_path_find's specific functionality, you can do the following
9
+
10
+ gem install 'callsite'
11
+
12
+ And in ruby
13
+
14
+ require 'load_path_find'
15
+
16
+ Now everything below will work as-is!
17
+
5
18
  == Usage
6
19
 
7
20
  > require 'load_path_find'
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ begin
9
9
  s.homepage = "http://github.com/joshbuddy/load_path_find"
10
10
  s.authors = "Joshua Hull"
11
11
  s.files = FileList["[A-Z]*", "{lib,spec,rails}/**/*"]
12
- s.add_dependency 'dirge', '>=0.0.3'
12
+ s.add_dependency 'callsite', '>=0.0.2'
13
13
  end
14
14
  Jeweler::GemcutterTasks.new
15
15
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: load_path_find
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 19
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 5
9
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
10
11
  platform: ruby
11
12
  authors:
12
13
  - Joshua Hull
@@ -14,21 +15,23 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-04-05 00:00:00 -04:00
18
+ date: 2010-05-31 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: dirge
22
+ name: callsite
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 27
27
30
  segments:
28
31
  - 0
29
32
  - 0
30
- - 3
31
- version: 0.0.3
33
+ - 2
34
+ version: 0.0.2
32
35
  type: :runtime
33
36
  version_requirements: *id001
34
37
  description: Convenient way to find stuff on the load path.
@@ -43,15 +46,6 @@ files:
43
46
  - README.rdoc
44
47
  - Rakefile
45
48
  - VERSION
46
- - lib/load_path_find.rb
47
- - spec/data/dir1/file1
48
- - spec/data/dir1/test.rb
49
- - spec/data/dir1/test2.rb
50
- - spec/data/dir2/file1
51
- - spec/data/dir2/test.rb
52
- - spec/data/dir2/test2.rb
53
- - spec/load_path_find_spec.rb
54
- - spec/spec.opts
55
49
  has_rdoc: true
56
50
  homepage: http://github.com/joshbuddy/load_path_find
57
51
  licenses: []
@@ -62,29 +56,29 @@ rdoc_options:
62
56
  require_paths:
63
57
  - lib
64
58
  required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
65
60
  requirements:
66
61
  - - ">="
67
62
  - !ruby/object:Gem::Version
63
+ hash: 3
68
64
  segments:
69
65
  - 0
70
66
  version: "0"
71
67
  required_rubygems_version: !ruby/object:Gem::Requirement
68
+ none: false
72
69
  requirements:
73
70
  - - ">="
74
71
  - !ruby/object:Gem::Version
72
+ hash: 3
75
73
  segments:
76
74
  - 0
77
75
  version: "0"
78
76
  requirements: []
79
77
 
80
78
  rubyforge_project:
81
- rubygems_version: 1.3.6
79
+ rubygems_version: 1.3.7
82
80
  signing_key:
83
81
  specification_version: 3
84
82
  summary: Convenient way to find stuff on the load path.
85
- test_files:
86
- - spec/data/dir1/test.rb
87
- - spec/data/dir1/test2.rb
88
- - spec/data/dir2/test.rb
89
- - spec/data/dir2/test2.rb
90
- - spec/load_path_find_spec.rb
83
+ test_files: []
84
+
@@ -1,48 +0,0 @@
1
- require 'dirge'
2
-
3
- $LOAD_PATH.instance_eval do
4
- def find_file(file)
5
- find_all_files(file){|f| return f}
6
- nil
7
- end
8
-
9
- def find_all_files(file, ext = nil)
10
- file += ext if ext and File.extname(file) != ext
11
- inject([]){|ary, path|
12
- target = File.expand_path(file, path)
13
- if File.readable?(target)
14
- ary << target
15
- yield target if block_given?
16
- end
17
- ary
18
- }
19
- end
20
-
21
- def add_current
22
- self << __DIR_REL__(caller.first)
23
- end
24
-
25
- def add_current!
26
- self.unshift(__DIR_REL__(caller.first))
27
- end
28
-
29
- end
30
-
31
- module Kernel
32
- def require_all(req)
33
- $LOAD_PATH.find_all_files(req, ".rb") { |file| require file }
34
- end
35
-
36
- def require_next(req)
37
- found, current = false, File.expand_path(caller.first[/^[^:]+/])
38
- $LOAD_PATH.find_all_files(req, ".rb") do |file|
39
- if found
40
- $LOADED_FEATURES << req
41
- return require(file)
42
- else
43
- found = current == file
44
- end
45
- end
46
- require req
47
- end
48
- end
File without changes
@@ -1 +0,0 @@
1
- $state1 = true
@@ -1,2 +0,0 @@
1
- $test2 = 1
2
- require_next "test2"
File without changes
@@ -1 +0,0 @@
1
- $state2 = true
@@ -1 +0,0 @@
1
- $test2 = 2 if $test2 == 1
@@ -1,62 +0,0 @@
1
- require 'lib/load_path_find'
2
-
3
- $: << File.expand_path(File.join(File.dirname(__FILE__), 'data', 'dir1'))
4
- $: << File.expand_path(File.join(File.dirname(__FILE__), 'data', 'dir2'))
5
-
6
- describe 'load path find' do
7
- it "should find a file on the load path" do
8
- target = File.join('file1')
9
- $:.find_file(target)[-target.size, target.size].should == target
10
- end
11
-
12
- it "should find a directory on the load path" do
13
- target = "data/dir1"
14
- $:.find_file("../dir1")[-target.size, target.size].should == target
15
- end
16
-
17
- it "should find the first file when its ambigious" do
18
- target = File.join('file1')
19
- expected_target = File.join('dir1', 'file1')
20
- $:.find_file(target)[-expected_target.size, expected_target.size].should == expected_target
21
- end
22
-
23
- it "should find all files that match" do
24
- target = File.join('file1')
25
- expected_target = File.join('dir1', 'file1')
26
- $:.find_all_files(target).should == [
27
- File.expand_path(File.join(File.dirname(__FILE__), 'data', 'dir1', 'file1')),
28
- File.expand_path(File.join(File.dirname(__FILE__), 'data', 'dir2', 'file1'))
29
- ]
30
- end
31
-
32
- it "should yield all files that match if a block is given" do
33
- target = File.join('file1')
34
- mock = Object.new
35
- mock.should_receive(:hello).exactly(2).times
36
- $:.find_all_files(target) { mock.hello }
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
48
-
49
- it "should require_all" do
50
- $state1.should be_nil
51
- $state2.should be_nil
52
- require_all('test')
53
- $state1.should be_true
54
- $state2.should be_true
55
- end
56
-
57
- it "should require_next" do
58
- require 'test2'
59
- $test2.should == 2
60
- end
61
-
62
- end
@@ -1,7 +0,0 @@
1
- --colour
2
- --format
3
- specdoc
4
- --loadby
5
- mtime
6
- --reverse
7
- --backtrace