class Pantograph::LaneManagerBase
Base class for all LaneManager
classes Takes care of all common things like printing the lane description tables and loading .env files
Public Class Methods
finish_pantograph(ff, duration, error, skip_message: false)
click to toggle source
All the finishing up that needs to be done
# File pantograph/lib/pantograph/lane_manager_base.rb, line 10 def self.finish_pantograph(ff, duration, error, skip_message: false) # Sometimes we don't have a pantfile unless ff.nil? ff.runner.did_finish end # Finished with all the lanes Pantograph::JUnitGenerator.generate(Pantograph::Actions.executed_actions) print_table(Pantograph::Actions.executed_actions) Pantograph::PluginUpdateManager.show_update_status if error UI.error('pantograph finished with errors') unless skip_message raise error elsif duration > 5 UI.success("pantograph.tools just saved you #{duration} minutes! 🎉") unless skip_message else UI.success('pantograph.tools finished successfully 🎉') unless skip_message end end
print_error_line(ex)
click to toggle source
# File pantograph/lib/pantograph/lane_manager_base.rb, line 80 def self.print_error_line(ex) error_line = ex.backtrace.first return if error_line.nil? error_line = error_line.match("Pantfile:(\\d+):") return unless error_line line = error_line[1] UI.error("Error in your Pantfile at line #{line}") UI.content_error(File.read(PantographCore::PantographFolder.pantfile_path, encoding: "utf-8"), line) end
print_lane_context()
click to toggle source
# File pantograph/lib/pantograph/lane_manager_base.rb, line 59 def self.print_lane_context return if Actions.lane_context.empty? if PantographCore::Globals.verbose? UI.important('Lane Context:'.yellow) UI.message(Actions.lane_context) return end # Print a nice table unless in PantographCore::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: PantographCore::PrintTable.transform_output(rows) })) end
print_table(actions)
click to toggle source
Print a table as summary of the executed actions
# File pantograph/lib/pantograph/lane_manager_base.rb, line 33 def self.print_table(actions) return if actions.count == 0 return if PantographCore::Env.truthy?('PANTOGRAPH_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: "pantograph summary".green, headings: ["Step", "Action", "Time (in s)"], rows: PantographCore::PrintTable.transform_output(rows) )) puts("") end
skip_docs?()
click to toggle source
# File pantograph/lib/pantograph/lane_manager_base.rb, line 5 def self.skip_docs? Helper.test? || PantographCore::Env.truthy?("PANTOGRAPH_SKIP_DOCS") end