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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/elder_docs/cli.rb', line 16
def deploy
say '🚀 Starting ElderDocs deployment...', :green
definitions_path = options[:definitions]
articles_path = options[:articles]
unless File.exist?(definitions_path)
say "❌ Error: #{definitions_path} not found in current directory", :red
exit 1
end
unless File.exist?(articles_path)
say "⚠️ Warning: #{articles_path} not found. Creating empty articles file...", :yellow
File.write(articles_path, [].to_json)
end
output_path = File.expand_path(options[:output] || default_output_path, Dir.pwd)
ElderDocs.config.output_path = output_path
generator = Generator.new(
definitions_path: definitions_path,
articles_path: articles_path,
output_path: output_path,
api_server: options[:api_server],
skip_build: options[:skip_build],
force_build: options[:force_build]
)
begin
generator.generate!
say '✅ Documentation generated successfully!', :green
say "📦 Assets placed in: #{generator.output_path}", :cyan
rescue Generator::ValidationError => e
say "❌ Validation Error: #{e.message}", :red
exit 1
rescue StandardError => e
say "❌ Error: #{e.message}", :red
say e.backtrace.first(5).join("\n"), :yellow if options[:verbose]
exit 1
end
end
|