8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/docopslab/dev/auto_fix_asciidoc.rb', line 8
def fix_asciidoc_files _context, path: nil
adoc_files = if path
if File.directory?(path)
Dir.glob(File.join(path, '**', '*.adoc'))
elsif File.file?(path) && File.extname(path) == '.adoc'
[path]
else
puts "❌ Invalid path specified for AsciiDoc auto-fix: #{path}"
return false
end
else
Dev.find_asciidoc_files
end
if adoc_files.empty?
puts '✅ No AsciiDoc files found for auto-fix'
return true
end
fixed_count = 0
adoc_files.each do |file_path|
File.read(file_path)
Dev.run_script('adoc_section_ids.rb', [file_path])
end
if fixed_count.positive?
puts "✅ AsciiDoc auto-fix complete; #{fixed_count} files modified"
else
puts '✅ All AsciiDoc files are already compliant'
end
true
end
|