Class: Fastlane::ActionsList
- Inherits:
-
Object
- Object
- Fastlane::ActionsList
- Defined in:
- lib/fastlane/documentation/actions_list.rb
Class Method Summary collapse
-
.all_actions(platform = nil) ⇒ Object
Iterates through all available actions and yields from there.
-
.parse_options(options, fill_all = true) ⇒ Object
Helper:.
- .print_all(platform: nil) ⇒ Object
- .run(filter: nil, platform: nil) ⇒ Object
- .show_details(filter: nil) ⇒ Object
Class Method Details
.all_actions(platform = nil) ⇒ Object
Iterates through all available actions and yields from there
129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/fastlane/documentation/actions_list.rb', line 129 def self.all_actions(platform = nil) all_actions = Fastlane::Actions.constants.select {|c| Fastlane::Actions.const_get(c).kind_of? Class } all_actions.sort.each do |symbol| action = Fastlane::Actions.const_get(symbol) next if platform && !action.is_supported?(platform.to_sym) name = symbol.to_s.gsub('Action', '').fastlane_underscore yield action, name end end |
.parse_options(options, fill_all = true) ⇒ Object
Helper:
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/fastlane/documentation/actions_list.rb', line 142 def self.(, fill_all = true) rows = [] rows << [] if .kind_of? String if .kind_of? Array .each do |current| if current.kind_of? FastlaneCore::ConfigItem key_name = (current.optional ? " " : "* ") + current.key.to_s description = (current.description || '') + (current.default_value ? " (default: '#{current.default_value}')" : "") rows << [key_name.yellow, description, current.env_name] elsif current.kind_of? Array # Legacy actions that don't use the new config manager raise "Invalid number of elements in this row: #{current}. Must be 2 or 3".red unless [2, 3].include? current.count rows << current rows.last[0] = rows.last.first.yellow # color it yellow :) rows.last << nil while fill_all and rows.last.count < 3 # to have a nice border in the table end end end rows end |
.print_all(platform: nil) ⇒ Object
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 41 42 43 |
# File 'lib/fastlane/documentation/actions_list.rb', line 14 def self.print_all(platform: nil) rows = [] all_actions(platform) do |action, name| current = [] current << name.yellow if action < Action current << action.description if action.description = Array(action. || action.) current << .first.green if .count == 1 current << "Multiple".green if .count > 1 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 " Platform filter: #{platform}".magenta if platform puts " Total of #{rows.count} actions" puts "\nGet more information for one specific action using `fastlane action [name]`\n".green end |
.run(filter: nil, platform: nil) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fastlane/documentation/actions_list.rb', line 5 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) ⇒ Object
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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/fastlane/documentation/actions_list.rb', line 45 def self.show_details(filter: nil) 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 = Array(action. || action.) rows << ["Created by #{.join(', ').green}"] if .count > 0 puts Terminal::Table.new( title: filter.green, rows: rows ) puts "\n" = (action.) if action. if puts Terminal::Table.new( title: filter.green, headings: ['Key', 'Description', 'Env Var'], rows: ) required_count = action..count do |o| if o.kind_of?(FastlaneCore::ConfigItem) o.optional == false else false end end if required_count > 0 puts "#{required_count} of the available parameters are required".magenta puts "They are marked with an asterisk *".magenta end else puts "No available options".yellow end puts "\n" output = (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 if action.return_value puts Terminal::Table.new( title: "Return Value".green, headings: [], rows: [[action.return_value]] ) puts "" end puts "More information can be found on https://github.com/fastlane/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 |