mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-25 18:08:06 +08:00
34 lines
1.2 KiB
Ruby
Vendored
34 lines
1.2 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
require "fileutils"
|
|
|
|
task "documentation" do
|
|
generate_chat_documentation
|
|
end
|
|
|
|
def generate_chat_documentation
|
|
destination = Rails.root.join("documentation/chat/frontend/").to_s
|
|
config = Rails.root.join(".jsdoc").to_s
|
|
files = %w[
|
|
plugins/chat/assets/javascripts/discourse/lib/collection.js
|
|
plugins/chat/assets/javascripts/discourse/pre-initializers/chat-plugin-api.js
|
|
plugins/chat/assets/javascripts/discourse/services/chat-api.js
|
|
]
|
|
`yarn --silent jsdoc --readme plugins/chat/README.md -c #{config} #{files.join(" ")} -d #{destination}`
|
|
|
|
require "open3"
|
|
require "yard"
|
|
YARD::Templates::Engine.register_template_path(
|
|
Rails.root.join("documentation/yard-custom-template").to_s,
|
|
)
|
|
files = %w[
|
|
plugins/chat/app/services/base.rb
|
|
plugins/chat/app/services/update_user_last_read.rb
|
|
plugins/chat/app/services/trash_channel.rb
|
|
plugins/chat/app/services/update_channel.rb
|
|
plugins/chat/app/services/update_channel_status.rb
|
|
]
|
|
cmd =
|
|
"bundle exec yardoc -p documentation/yard-custom-template -t default -r plugins/chat/README.md --output-dir documentation/chat/backend #{files.join(" ")}"
|
|
Open3.popen3(cmd) { |_, stderr| puts stderr.read }
|
|
end
|