fastlane/lib/fastlane/documentation/markdown_docs_generator.rb in fastlane-2.193.1 vs fastlane/lib/fastlane/documentation/markdown_docs_generator.rb in fastlane-2.194.0
- old
+ new
@@ -132,19 +132,21 @@
def generate!(target_path: nil)
require 'yaml'
FileUtils.mkdir_p(target_path)
docs_dir = File.join(target_path, "docs")
+ generated_actions_dir = File.join("generated", "actions")
+ FileUtils.mkdir_p(File.join(docs_dir, generated_actions_dir))
# Generate actions.md
template = File.join(Fastlane::ROOT, "lib/assets/Actions.md.erb")
result = ERB.new(File.read(template), 0, '-').result(binding) # https://web.archive.org/web/20160430190141/www.rrn.dk/rubys-erb-templating-system
- File.write(File.join(docs_dir, "actions.md"), result)
+ File.write(File.join(docs_dir, "generated", "actions.md"), result)
- # Generate actions sub pages (e.g. actions/slather.md, actions/scan.md)
+ # Generate actions sub pages (e.g. generated/actions/slather.md, generated/actions/scan.md)
all_actions_ref_yml = []
- FileUtils.mkdir_p(File.join(docs_dir, "actions"))
+ FileUtils.mkdir_p(File.join(docs_dir, generated_actions_dir))
ActionsList.all_actions do |action|
@action = action # to provide a reference in the .html.erb template
@action_filename = filename_for_action(action)
unless @action_filename
@@ -163,13 +165,17 @@
end
template = File.join(Fastlane::ROOT, "lib/assets/ActionDetails.md.erb")
result = ERB.new(File.read(template), 0, '-').result(binding) # https://web.archive.org/web/20160430190141/www.rrn.dk/rubys-erb-templating-system
- file_name = File.join("actions", "#{action.action_name}.md")
+ # Actions get placed in "generated/actions" directory
+ file_name = File.join(generated_actions_dir, "#{action.action_name}.md")
File.write(File.join(docs_dir, file_name), result)
- all_actions_ref_yml << { action.action_name => file_name }
+ # The action pages when published get moved to the "actions" directory
+ # The mkdocs.yml file needs to reference the "actions" directory (not the "generated/actions" directory)
+ published_file_name = File.join("actions", "#{action.action_name}.md")
+ all_actions_ref_yml << { action.action_name => published_file_name }
end
# Modify the mkdocs.yml to list all the actions
mkdocs_yml_path = File.join(target_path, "mkdocs.yml")
raise "Could not find mkdocs.yml in #{target_path}, make sure to point to the fastlane/docs repo" unless File.exist?(mkdocs_yml_path)