require_tree 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ingwen.rb +19 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2b66d39a47740882c39cbd5eac4c853cae297e8
|
4
|
+
data.tar.gz: 26bc7ff4dfd9ce42f3612f7f1cde8ea862c8658d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6579b81f5554b4ea7d3301d9c5d0a8ac1909a0523df657c0cce297684ad1feadc6e291ab1051188cfb8229bae13d788f3c518cf37fc4e14dc35cf176c31a10c4
|
7
|
+
data.tar.gz: a94a72c96d0da157cf98a9bc235c9872a1cf3d181895df132c6378a83cf8d468ba1b1dea3c66ec39586211a412778890fc550ba3fbf76b4a0ea1b6b63e9a7082
|
data/lib/ingwen.rb
CHANGED
@@ -1,18 +1,27 @@
|
|
1
1
|
module Kernel
|
2
|
-
def require_tree path
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
def require_tree path, opt={}
|
3
|
+
force = opt[:force] || false
|
4
|
+
caller_file = caller_locations.first.absolute_path
|
5
|
+
caller_path = caller_file + '/..'
|
6
|
+
if force
|
7
|
+
rb_files_queue = []
|
8
|
+
parse_path_f path, caller_path, rb_files_queue
|
9
|
+
rb_files_queue.delete caller_file
|
10
|
+
try_and_error rb_files_queue
|
11
|
+
else
|
12
|
+
|
13
|
+
end
|
6
14
|
end
|
7
15
|
|
8
16
|
private
|
9
|
-
def
|
10
|
-
|
17
|
+
def parse_path_f path, base, queue
|
18
|
+
full_path = path == '.' ? "#{base}/*" : "#{base}/#{path}/*"
|
19
|
+
Dir[full_path].each {|sym|
|
11
20
|
begin
|
12
|
-
if File.directory?
|
13
|
-
|
14
|
-
elsif
|
15
|
-
queue <<
|
21
|
+
if File.directory? sym
|
22
|
+
parse_path_f '.', sym, queue
|
23
|
+
elsif sym =~ /\.rb$/
|
24
|
+
queue << sym
|
16
25
|
end
|
17
26
|
end
|
18
27
|
}
|