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
|
# File 'lib/elder_docs/cli.rb', line 16
def deploy
say '🚀 Building ElderDocs frontend...', :green
say '📝 Note: definitions.json and articles.json are loaded dynamically at runtime', :cyan
say ' No need to rebuild when you update your API definitions!', :cyan
say ''
output_path = File.expand_path(options[:output] || default_output_path, Dir.pwd)
ElderDocs.config.output_path = output_path
ElderDocs.config.load_config_file
generator = Generator.new(
definitions_path: nil,
articles_path: nil,
output_path: output_path,
api_server: options[:api_server],
skip_build: options[:skip_build],
force_build: options[:force_build]
)
begin
generator.build_frontend_only!
say '✅ Frontend built successfully!', :green
say "📦 Assets placed in: #{generator.output_path}", :cyan
say ''
say '✨ Your documentation is now live!', :green
say ' Edit definitions.json and articles.json - changes appear instantly!', :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
|