class Fastlane::ActionsList

Public Class Methods

action_subclass_error(name) click to toggle source
# File fastlane/lib/fastlane/documentation/actions_list.rb, line 102
def self.action_subclass_error(name)
  "Please update your action '#{name}' to be a subclass of `Action` by adding ` < Action` after your class name."
end
all_actions(platform = nil) { |action, name| ... } click to toggle source

Iterates through all available actions and yields from there

# File fastlane/lib/fastlane/documentation/actions_list.rb, line 170
def self.all_actions(platform = nil)
  action_symbols = Fastlane::Actions.constants.select { |c| Fastlane::Actions.const_get(c).kind_of?(Class) && c != :TestSampleCodeAction }
  action_symbols.sort.each do |symbol|
    action = Fastlane::Actions.const_get(symbol)

    # We allow classes that don't respond to is_supported? to come through because we want to list
    # them as broken actions in the table, regardless of platform specification
    next if platform && action.respond_to?(:is_supported?) && !action.is_supported?(platform.to_sym)

    name = symbol.to_s.gsub(/Action$/, '').fastlane_underscore
    yield(action, name)
  end
end
find_action_named(name) click to toggle source
# File fastlane/lib/fastlane/documentation/actions_list.rb, line 184
def self.find_action_named(name)
  all_actions do |action, action_name|
    return action if action_name == name
  end

  nil
end
parse_options(options, fill_all = true) click to toggle source

Helper:

# File fastlane/lib/fastlane/documentation/actions_list.rb, line 193
def self.parse_options(options, fill_all = true)
  rows = []
  rows << [options] if options.kind_of?(String)

  if options.kind_of?(Array)
    options.each do |current|
      if current.kind_of?(FastlaneCore::ConfigItem)
        rows << [current.key.to_s.yellow, current.deprecated ? current.description.red : current.description, current.env_names.join(", "), current.help_default_value]
      elsif current.kind_of?(Array)
        # Legacy actions that don't use the new config manager
        UI.user_error!("Invalid number of elements in this row: #{current}. Must be 2 or 3") unless [2, 3].include?(current.count)
        rows << current
        rows.last[0] = rows.last.first.yellow # color it yellow :)
        rows.last << nil while fill_all && rows.last.count < 4 # to have a nice border in the table
      end
    end
  end

  rows
end
print_all(platform: nil) click to toggle source
print_options(action, name) click to toggle source
print_output_variables(action, name) click to toggle source
print_return_value(action, name) click to toggle source
print_suggestions(filter) click to toggle source
print_summary(action, name) click to toggle source
run(filter: nil, platform: nil) click to toggle source
# File fastlane/lib/fastlane/documentation/actions_list.rb, line 3
def self.run(filter: nil, platform: nil)
  require 'terminal-table'
  if filter
    show_details(filter: filter)
  else
    print_all(platform: platform)
  end
end
show_details(filter: nil) click to toggle source
# File fastlane/lib/fastlane/documentation/actions_list.rb, line 48
def self.show_details(filter: nil)
  puts("Loading documentation for #{filter}:".green)
  puts("")

  action = find_action_named(filter)

  if action
    unless action < Action
      UI.user_error!(action_subclass_error(filter))
    end

    print_summary(action, filter)
    print_options(action, filter)
    print_output_variables(action, filter)
    print_return_value(action, filter)

    if Fastlane::Actions.is_deprecated?(action)
      puts("==========================================".deprecated)
      puts("This action (#{filter}) is deprecated".deprecated)
      puts(action.deprecated_notes.to_s.remove_markdown.deprecated) if action.deprecated_notes
      puts("==========================================\n".deprecated)
    end

    puts("More information can be found on https://docs.fastlane.tools/actions/#{filter}")
    puts("")
  else
    puts("Couldn't find action for the given filter.".red)
    puts("==========================================\n".red)

    print_all # show all available actions instead
    print_suggestions(filter)
  end
end