lib/fastlane/environment_printer.rb in fastlane-1.107.0 vs lib/fastlane/environment_printer.rb in fastlane-1.108.0

- old
+ new

@@ -13,10 +13,11 @@ 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 @@ -126,10 +127,39 @@ env_output << rendered_table.to_md env_output << "</details>\n\n" return env_output end + def self.print_system_locale + env_output = "### System Locale\n\n" + found_one = false + env_table = "" + ["LANG", "LC_ALL", "LANGUAGE"].each do |e| + env_icon = "🚫" + if ENV[e] && ENV[e].end_with?("UTF-8") + env_icon = "✅" + found_one = true + end + if ENV[e].nil? + env_icon = "" + end + env_table << "| #{e} | #{ENV[e]} | #{env_icon} |\n" + end + if !found_one + table = "| Error |\n" + table << "|-----|\n" + table << "| No Locale with UTF8 found 🚫|\n" + else + table = "| Variable | Value | |\n" + table << "|-----|---------|----|\n" + table << env_table + end + rendered_table = MarkdownTableFormatter.new table + env_output << rendered_table.to_md + env_output << "\n\n" + end + def self.print_system_environment require "openssl" env_output = "### Stack\n\n" product, version, build = `sw_vers`.strip.split("\n").map { |line| line.split(':').last.strip } @@ -199,13 +229,10 @@ # 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 def self.copy_to_clipboard(string) - require 'tempfile' - Tempfile.create('environment_printer') do |tmp_file| - File.write(tmp_file, string) - `cat '#{tmp_file.path}' | pbcopy` - end + require 'open3' + Open3.popen3('pbcopy') { |input, _, _| input << string } end end end