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
97
98
99
100
|
# File 'lib/forcast/tasks/documentation/documentation.rb', line 66
def init_documentation(root)
system("rm -R #{root}/documentation/")
documents = YAML.load_file("#{root}/config/documentation_files.yml")
documents.each do |document|
begin
document = YAML.load_file("#{root}/"+document["file"]+".yml")
relative_path_document = document["relative_path"]
files = document["files"]
@absolute_path = "#{root}/"+relative_path_document.to_s
files.each do |documentation_file|
documentation_file = documentation_file["file"]
file_path = @absolute_path + documentation_file["path"]+".rb"
copy_to_documentation(file_path,"#{root}/"+"documentation"+relative_path_document)
file_path_documentation = "#{root}/"+"documentation"+relative_path_document+documentation_file["path"]+".rb"
= documentation_file["comments"]
body = documentation_file["body"]
lines_to_scan = body.keys
positions_lines = open_file_and_find_lines_to(file_path,lines_to_scan)
new_lines = 0
positions_lines.each_with_index do |line,index|
line[:documentation] = body[line[:line_match]]["documentation"]
line[:line_num] += new_lines
new_lines = add_documentation_to_line(file_path_documentation,line,new_lines)
end
(file_path_documentation,)
puts "Terminado archivo: "+file_path_documentation.to_s
end
rescue Exception => e
puts e
next
end
end
end
|