Sha256: 604ec99250aed8920db454db7d95f12daef105909f91639cb2fed9a9b07bc38e

Contents?: true

Size: 1.47 KB

Versions: 8

Compression:

Stored size: 1.47 KB

Contents

module Fastlane
  class DocsGenerator
    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.description_blocks.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 << "## #{platform}" if platform

        value = ff.runner.description_blocks[platform]

        value.each do |lane, description|
          output << render(platform, lane, description)          
        end

        output << "----"
      end

      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

    private

      def self.render(platform, lane, description)
        full_name = [platform, lane].reject(&:nil?).join(' ')

        output = []
        output << "### #{full_name}"
        output << "```"
        output << "fastlane #{full_name}"
        output << "```"
        output << description
        output
      end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fastlane-0.13.0 lib/fastlane/docs_generator.rb
fastlane-0.12.5 lib/fastlane/docs_generator.rb
fastlane-0.12.4 lib/fastlane/docs_generator.rb
fastlane-0.12.3 lib/fastlane/docs_generator.rb
fastlane-0.12.2 lib/fastlane/docs_generator.rb
fastlane-0.12.1 lib/fastlane/docs_generator.rb
fastlane-0.12.0 lib/fastlane/docs_generator.rb
fastlane-0.11.0 lib/fastlane/docs_generator.rb