require_tree 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/lib/ingwen.rb +11 -4
- 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: e1c653606568d0a21f9eb0c80be12d190786a3da
|
4
|
+
data.tar.gz: 0198abb262969fcf67df8e7f0839f6af60d4a837
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c8535f35141bf3eb18d44f0832075f25f45e3cdafa1e3fda2afad84845cc514d46e7993b7bc750711549e96b365f24591dddc1eb7ec230b0e502b4cec97f982
|
7
|
+
data.tar.gz: 03c2d0edd2462affe9cdaec043652369e6f6975d48054967c732c578de71994fc4830ab04506882a030f61cc38d06c9a35fde830f14433fd549e5a144c8bc5cb
|
data/lib/ingwen.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
module Kernel
|
2
2
|
def require_tree path, opt={}
|
3
3
|
force = opt[:force] || false
|
4
|
+
debug = opt[:debug] || false
|
4
5
|
caller_file = caller_locations.first.absolute_path
|
5
6
|
caller_path = caller_file + '/..'
|
6
7
|
if force
|
7
8
|
rb_files_queue = []
|
8
9
|
parse_path_f path, caller_path, rb_files_queue
|
9
10
|
rb_files_queue.delete caller_file
|
10
|
-
try_and_error rb_files_queue
|
11
|
+
try_and_error rb_files_queue, debug: debug
|
11
12
|
else
|
12
13
|
|
13
14
|
end
|
@@ -27,14 +28,20 @@ module Kernel
|
|
27
28
|
}
|
28
29
|
end
|
29
30
|
|
30
|
-
def try_and_error queue
|
31
|
+
def try_and_error queue, opt={}
|
32
|
+
debug = opt[:debug] || false
|
31
33
|
max_count = queue.count
|
32
|
-
loaded
|
34
|
+
loaded = []
|
33
35
|
queue.each_with_index do |file, i|
|
34
36
|
begin
|
35
37
|
require file
|
36
38
|
loaded << file
|
37
|
-
|
39
|
+
puts ">> #{file} loaded... " if debug
|
40
|
+
rescue NameError => e
|
41
|
+
puts ">> #{file} NameError..." if debug
|
42
|
+
next
|
43
|
+
rescue LoadError => e
|
44
|
+
puts ">> #{file} LoadError..." if debug
|
38
45
|
next
|
39
46
|
end
|
40
47
|
end
|