-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathllms_txt.rake
More file actions
32 lines (26 loc) · 934 Bytes
/
llms_txt.rake
File metadata and controls
32 lines (26 loc) · 934 Bytes
1
2
3
4
5
6
7
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
# frozen_string_literal: true
require_relative "../llms_txt_generator"
# Rake task to generate /public/llms.txt from doc views.
#
# Usage:
# rake llms:generate
# rake llms:generate[https://rubyui.com] # custom base URL
namespace :llms do
desc "Generate public/llms.txt from doc view files"
task :generate, [:base_url] do |_t, args|
docs_dir = File.expand_path("../../app/views/docs", __dir__)
output_path = File.expand_path("../../public/llms.txt", __dir__)
generator = LlmsTxtGenerator.new(
docs_dir: docs_dir,
base_url: args[:base_url] || "https://rubyui.com"
)
count = generator.write(output_path)
puts "Generated #{output_path} (#{count} components)"
end
end
# Auto-generate llms.txt during assets:precompile (Heroku & Docker builds)
if Rake::Task.task_defined?("assets:precompile")
Rake::Task["assets:precompile"].enhance do
Rake::Task["llms:generate"].invoke
end
end