class Fastlane::EnvironmentPrinter

Public Class Methods

anonymized_path(path, home = ENV['HOME']) click to toggle source
# File fastlane/lib/fastlane/environment_printer.rb, line 286
def self.anonymized_path(path, home = ENV['HOME'])
  return home ? path.gsub(%r{^#{home}(?=/(.*)|$)}, '~\2') : path
end
copy_to_clipboard(string) click to toggle source

Copy a given string into the clipboard Make sure to ask the user first, as some people don't use a clipboard manager, so they might lose something important

# File fastlane/lib/fastlane/environment_printer.rb, line 293
def self.copy_to_clipboard(string)
  require 'open3'
  Open3.popen3('pbcopy') { |input, _, _| input << string }
end
gems_to_check() click to toggle source

We have this as a separate method, as this has to be handled slightly differently, depending on how fastlane is being called

# File fastlane/lib/fastlane/environment_printer.rb, line 89
def self.gems_to_check
  if Helper.contained_fastlane?
    Gem::Specification
  else
    Gem.loaded_specs.values
  end
end
get() click to toggle source
# File fastlane/lib/fastlane/environment_printer.rb, line 20
def self.get
  UI.important("Generating fastlane environment output, this might take a few seconds...")
  require "fastlane/markdown_table_formatter"
  env_output = ""
  env_output << print_system_environment
  env_output << print_system_locale
  env_output << print_fastlane_files
  env_output << print_loaded_fastlane_gems
  env_output << print_loaded_plugins
  env_output << print_loaded_gems
  env_output << print_date

  # Adding title
  status = (env_output.include?("🚫") ? "🚫" : "✅")
  env_header = "<details><summary>#{status} fastlane environment #{status}</summary>\n\n"
  env_tail = "</details>"
  final_output = ""

  if FastlaneCore::Globals.captured_output?
    final_output << "### Captured Output\n\n"
    final_output << "Command Used: `#{ARGV.join(' ')}`\n"
    final_output << "<details><summary>Output/Log</summary>\n\n```\n\n#{FastlaneCore::Globals.captured_output}\n\n```\n\n</details>\n\n"
  end

  final_output << env_header + env_output + env_tail
end
git_version() click to toggle source
# File fastlane/lib/fastlane/environment_printer.rb, line 298
def self.git_version
  return `git --version`.strip.split("\n").first
rescue
  return "not found"
end
output() click to toggle source
# File fastlane/lib/fastlane/environment_printer.rb, line 3
def self.output
  env_info = get

  # Remove sensitive option values
  FastlaneCore::Configuration.sensitive_strings.compact.each do |sensitive_element|
    env_info.gsub!(sensitive_element, "#########")
  end

  puts(env_info)
  UI.important("Take notice that this output may contain sensitive information, or simply information that you don't want to make public.")
  if FastlaneCore::Helper.mac? && UI.interactive? && UI.confirm("🙄  Wow, that's a lot of markdown text... should fastlane put it into your clipboard, so you can easily paste it on GitHub?")
    copy_to_clipboard(env_info)
    UI.success("Successfully copied markdown into your clipboard 🎨")
  end
  UI.success("Open https://github.com/fastlane/fastlane/issues/new to submit a new issue ✅")
end
print_date() click to toggle source
print_fastlane_files() click to toggle source
print_loaded_fastlane_gems() click to toggle source
print_loaded_gems() click to toggle source
print_loaded_plugins() click to toggle source
print_system_environment() click to toggle source
print_system_locale() click to toggle source