Class: Fastlane::LaneManagerBase
- Inherits:
-
Object
- Object
- Fastlane::LaneManagerBase
- Defined in:
- fastlane/lib/fastlane/lane_manager_base.rb
Overview
Base class for all LaneManager classes Takes care of all common things like printing the lane description tables and loading .env files
Direct Known Subclasses
Class Method Summary collapse
-
.finish_fastlane(ff, duration, error, skip_message: false) ⇒ Object
All the finishing up that needs to be done.
- .print_error_line(ex) ⇒ Object
- .print_lane_context ⇒ Object
-
.print_table(actions) ⇒ Object
Print a table as summary of the executed actions.
- .skip_docs? ⇒ Boolean
Class Method Details
.finish_fastlane(ff, duration, error, skip_message: false) ⇒ Object
All the finishing up that needs to be done
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'fastlane/lib/fastlane/lane_manager_base.rb', line 10 def self.finish_fastlane(ff, duration, error, skip_message: false) # Sometimes we don't have a fastfile because we're using Fastfile.swift unless ff.nil? ff.runner.did_finish end # Finished with all the lanes Fastlane::JUnitGenerator.generate(Fastlane::Actions.executed_actions) print_table(Fastlane::Actions.executed_actions) Fastlane::PluginUpdateManager.show_update_status if error UI.error('fastlane finished with errors') unless raise error elsif duration > 5 UI.success("fastlane.tools just saved you #{duration} minutes! 🎉") unless else UI.success('fastlane.tools finished successfully 🎉') unless end end |
.print_error_line(ex) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'fastlane/lib/fastlane/lane_manager_base.rb', line 80 def self.print_error_line(ex) lines = ex.backtrace_locations&.select { |loc| loc.path == 'Fastfile' }&.map(&:lineno) return if lines.nil? || lines.empty? fastfile_content = File.read(FastlaneCore::FastlaneFolder.fastfile_path, encoding: "utf-8") if ex.backtrace_locations.first&.path == 'Fastfile' # If exception happened directly in the Fastfile itself (e.g. ArgumentError) UI.error("Error in your Fastfile at line #{lines.first}") UI.content_error(fastfile_content, lines.first) lines.shift end unless lines.empty? # If exception happened directly in the Fastfile, also print the caller (still from the Fastfile). # If exception happened in _fastlane_ internal code, print the line from the Fastfile that called it UI.error("Called from Fastfile at line #{lines.first}") UI.content_error(fastfile_content, lines.first) end end |
.print_lane_context ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'fastlane/lib/fastlane/lane_manager_base.rb', line 59 def self.print_lane_context return if Actions.lane_context.empty? if FastlaneCore::Globals.verbose? UI.important('Lane Context:'.yellow) UI.(Actions.lane_context) return end # Print a nice table unless in FastlaneCore::Globals.verbose? mode rows = Actions.lane_context.collect do |key, content| [key, content.to_s] end require 'terminal-table' puts(Terminal::Table.new({ title: "Lane Context".yellow, rows: FastlaneCore::PrintTable.transform_output(rows) })) end |
.print_table(actions) ⇒ Object
Print a table as summary of the executed actions
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'fastlane/lib/fastlane/lane_manager_base.rb', line 33 def self.print_table(actions) return if actions.count == 0 return if FastlaneCore::Env.truthy?('FASTLANE_SKIP_ACTION_SUMMARY') # User disabled table output require 'terminal-table' rows = [] actions.each_with_index do |current, i| is_error_step = !current[:error].to_s.empty? name = current[:name][0..60] name = name.red if is_error_step index = i + 1 index = "💥" if is_error_step rows << [index, name, current[:time].to_i] end puts("") puts(Terminal::Table.new( title: "fastlane summary".green, headings: ["Step", "Action", "Time (in s)"], rows: FastlaneCore::PrintTable.transform_output(rows) )) puts("") end |
.skip_docs? ⇒ Boolean
5 6 7 |
# File 'fastlane/lib/fastlane/lane_manager_base.rb', line 5 def self.skip_docs? Helper.test? || FastlaneCore::Env.truthy?("FASTLANE_SKIP_DOCS") end |