46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/dash_overlord/requirable.rb', line 46
def load(paths)
_current_file = nil
files = [*paths].flatten.map { |path| dir_list(path) }.flatten.uniq
until files.empty?
last_file_counter = files.length
fatal, error = nil, nil
files.dup.each do |file|
_current_file = figure_path(file)
begin
require figure_path(file)
files.delete(file)
rescue NameError, LoadError => error
rescue Exception => fatal
break
end
end
if fatal
exception = fatal || error
puts "Requirable:73 raised and exception: #{fatal}"
raise exception
end
if last_file_counter == files.length && error
_splitted = _current_file.split('/')
_current_file_name = _splitted[-1]
_current_file_dir = _splitted[0..-2].join('/')
raise %Q{
An error occurred while loading #{_current_file_name}
Error:
#{error}
Possible problems:
- Syntax error on #{_current_file_name}
- LOAD_PATH does not have app ROOT_PATH so it can find #{_current_file_name} inside #{_current_file_dir}
}
end
end
end
|