Module: Pod::UserInterface::ErrorReport
- Defined in:
- lib/cocoapods/user_interface/error_report.rb
Class Method Summary collapse
- .markdown_podfile ⇒ Object
- .plugins_string ⇒ Object
- .report(exception) ⇒ Object
- .report_instructions ⇒ Object
- .stack ⇒ Object
Class Method Details
.markdown_podfile ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/cocoapods/user_interface/error_report.rb', line 103 def markdown_podfile return '' unless Config.instance.podfile_path && Config.instance.podfile_path.exist? <<-EOS ### Podfile ```ruby #{Config.instance.podfile_path.read.strip} ``` EOS end |
.plugins_string ⇒ Object
95 96 97 98 99 100 101 |
# File 'lib/cocoapods/user_interface/error_report.rb', line 95 def plugins_string plugins = installed_plugins max_name_length = plugins.keys.map(&:length).max plugins.map do |name, version| "#{name.ljust(max_name_length)} : #{version}" end.sort.join("\n") end |
.report(exception) ⇒ Object
10 11 12 13 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 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/cocoapods/user_interface/error_report.rb', line 10 def report(exception) <<-EOS #{'――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed} ### Command ``` #{original_command} ``` #{report_instructions} #{stack} ### Plugins ``` #{plugins_string} ``` #{markdown_podfile} ### Error ``` #{exception.class} - #{exception.} #{exception.backtrace.join("\n")} ``` #{'――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed} #{'[!] Oh no, an error occurred.'.red} #{error_from_podfile(exception)} #{'Search for existing GitHub issues similar to yours:'.yellow} #{issues_url(exception)} #{'If none exists, create a ticket, with the template displayed above, on:'.yellow} https://github.com/CocoaPods/CocoaPods/issues/new #{'Be sure to first read the contributing guide for details on how to properly submit a ticket:'.yellow} https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md Don't forget to anonymize any private data! EOS end |
.report_instructions ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cocoapods/user_interface/error_report.rb', line 55 def report_instructions <<-EOS ### Report * What did you do? * What did you expect to happen? * What happened instead? EOS end |
.stack ⇒ Object
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 |
# File 'lib/cocoapods/user_interface/error_report.rb', line 67 def stack parts = { 'CocoaPods' => Pod::VERSION, 'Ruby' => RUBY_DESCRIPTION, 'RubyGems' => Gem::VERSION, 'Host' => host_information, 'Xcode' => xcode_information, 'Git' => git_information, 'Ruby lib dir' => RbConfig::CONFIG['libdir'], 'Repositories' => repo_information, } justification = parts.keys.map(&:size).max str = <<-EOS ### Stack ``` EOS parts.each do |name, value| str << name.rjust(justification) str << ' : ' str << Array(value).join("\n" << (' ' * (justification + 3))) str << "\n" end str << "```\n" end |