Class: Fastlane::DocsGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/docs_generator.rb

Class Method Summary collapse

Class Method Details

.run(output_path, ff) ⇒ Object



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
33
34
35
36
37
38
39
40
# File 'lib/fastlane/docs_generator.rb', line 3

def self.run(output_path, ff)
  output = ["fastlane documentation"]
  output << "================"

  output << "# Installation"
  output << "```"
  output << "sudo gem install fastlane"
  output << "```"

  output << "# Available Actions"
  
  all_keys = ff.runner.lanes.keys.reject(&:nil?) 
  all_keys.unshift(nil) # because we want root elements on top. always! They have key nil

  all_keys.each do |platform|
    output << "## #{formatted_platform(platform)}" if platform

    value = ff.runner.lanes[platform]

    if value
      value.each do |lane_name, lane|
        next if lane.is_private
        output << render(platform, lane_name, lane.description.join("\n\n"))          
      end

      output << ""
      output << "----"
      output << ""
    end
  end

  output << "Generate this documentation by running `fastlane docs`"
  output << "More information about fastlane can be found on [https://fastlane.tools](https://fastlane.tools)."
  output << "The documentation of fastlane can be found on [GitHub](https://github.com/KrauseFx/fastlane)"

  File.write(output_path, output.join("\n"))
  Helper.log.info "Successfully generated documentation to path '#{File.expand_path(output_path)}'".green
end