Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- root = 'C:/rb_incom-realty.ru/'
- @template_tree = {}
- def parse_directory(path)
- Dir.foreach path do |d|
- if File.file?(f = path + d)
- if d =~ /.\.asp$/
- @template_tree[f] ||= []
- file = File.open(f, "r")
- while line = file.gets
- if line =~ /<!--.*#include.*-->/
- @template_tree[f] << path + Regexp.last_match(0)[/".*"/].slice(2..-2)
- end
- end
- file.close
- end
- else
- parse_directory "#{path}#{d}/" if (d != '.' && d != '..')
- end
- end
- end
- parse_directory(root)
- @template_tree.each do |key,value|
- puts "#{key}: #{value}"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement