Class: Fastlane::ActionsList

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

Class Method Summary collapse

Class Method Details

.all_actionsObject

Iterates through all available actions and yields from there



107
108
109
110
111
112
113
114
# File 'lib/fastlane/actions_list.rb', line 107

def self.all_actions
  all_actions = Fastlane::Actions.constants.select {|c| Class === Fastlane::Actions.const_get(c)}
  all_actions.sort.each do |symbol|        
    action = Fastlane::Actions.const_get(symbol)
    name = symbol.to_s.gsub('Action', '').fastlane_underscore
    yield action, name
  end
end


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
# File 'lib/fastlane/actions_list.rb', line 9

def self.print_all
  rows = []
  all_actions do |action, name|
    current = []
    current << name.yellow

    if action < Action
      current << action.description if action.description

      authors = Array(action.author || action.authors)
      current << authors.first.green if authors.count == 1
      current << "Multiple".green if authors.count > 1

      l = (action.description || '').length
    else
      Helper.log.error "Please update your action file #{name} to be a subclass of `Action` by adding ` < Action` after your class name.".red
      current << "Please update action file".red
    end
    rows << current
  end

  table = Terminal::Table.new(
    title: "Available fastlane actions".green,
    headings: ['Action', 'Description', 'Author'],
    rows: rows
  )
  puts table
  puts "  Total of #{rows.count} actions"

  puts "\nGet more information for one specific action using `fastlane action [name]`\n".green
end

.run(filter) ⇒ Object



3
4
5
6
7
# File 'lib/fastlane/actions_list.rb', line 3

def self.run(filter)
  require 'terminal-table'
  print_all unless filter
  show_details(filter) if filter
end

.show_details(filter) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/fastlane/actions_list.rb', line 41

def self.show_details(filter)
  puts "Loading documentation for #{filter}:".green

  puts ""

  all_actions do |action, name|
    next unless name == filter.strip
    
    rows = []
    rows << [action.description] if action.description
    rows << [' ']
    if action.details
      rows << [action.details]
      rows << [' ']
    end

    authors = Array(action.author || action.authors)

    rows << ["Created by #{authors.join(', ').green}"] if authors.count > 0

    puts Terminal::Table.new(
      title: filter.green,
      rows: rows
    )

    puts "\n"

    options = parse_options(action.available_options) if action.available_options

    if options
      puts Terminal::Table.new(
        title: filter.green,
        headings: ['Key', 'Description', 'Env Var'],
        rows: options
      )
    else
      puts "No available options".yellow
    end
    puts "\n"

    output = parse_options(action.output, false) if action.output
    if output and output.count > 0
      puts Terminal::Table.new(
        title: [filter, "| Output Variables"].join(" ").green,
        headings: ['Key', 'Description'],
        rows: output
      )
      puts "Access the output values using `lane_context[SharedValues::VARIABLE_NAME]`"
      puts ""
    end

    

    puts "More information can be found on https://github.com/KrauseFx/fastlane/blob/master/docs/Actions.md"
    puts "\n"

    return # our job is done here
  end

  puts "Couldn't find action for the given filter.".red
  puts "==========================================\n".red
  print_all # show all available actions instead
end