6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/capistrano/dotenv/env_extractor.rb', line 6
def (globs = '*')
results = Hash.new { |hash, key| hash[key] = [] }
Array(globs).each do |glob|
Dir.glob(glob).each do |item|
next if File.basename(item)[0] == ?.
if File.directory?(item)
results.merge!(("#{item}/*"))
else
next unless extensions.detect {|ext| File.extname(item)[ext] }
File.readlines(item).each_with_index do |line, ix|
capture_variables(line).each do |variable|
results[variable] << { :path => item, :line => ix.succ }
end
end
end
end
end
results
end
|