Commit ae47110f authored by Fabio Pelosin's avatar Fabio Pelosin

[colors] Improved error report

  - added colors
  - now the instructions appear after the teamplate
    and are visibile to the user as the last lines
  - fine tuned template
parent 3b83f2a6
...@@ -8,18 +8,8 @@ module Pod ...@@ -8,18 +8,8 @@ module Pod
class << self class << self
def report(error) def report(error)
return <<-EOS return <<-EOS
Oh no, an error occurred. #{error_from_podfile(error)}
Search for existing github issues similar to yours:
https://github.com/CocoaPods/CocoaPods/issues/search?q=%22#{CGI.escape(error.message)}%22
If none exists, create a ticket, with the information in the below (markdown formatted) template, on:
https://github.com/CocoaPods/CocoaPods/issues/new
**Don't forget to anonymize any private data!**
#{'――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
### Report ### Report
...@@ -32,29 +22,41 @@ If none exists, create a ticket, with the information in the below (markdown for ...@@ -32,29 +22,41 @@ If none exists, create a ticket, with the information in the below (markdown for
### Stack ### Stack
* Host version: #{host_information} ```
* Xcode version: #{xcode_information} CocoaPods : #{Pod::VERSION}
* Ruby version: #{RUBY_DESCRIPTION} Ruby : #{RUBY_DESCRIPTION}
* Ruby lib dir: #{RbConfig::CONFIG['libdir']} RubyGems : #{Gem::VERSION}
* RubyGems version: #{Gem::VERSION} Host : #{host_information}
* CocoaPods version: #{Pod::VERSION} Xcode : #{xcode_information}
* Specification repositories: Ruby lib dir : #{RbConfig::CONFIG['libdir']}
- #{repo_information.join("\n - ")} Repositories : #{repo_information.join("\n ")}
```
### Podfile ### Podfile
```ruby ```ruby
#{Config.instance.project_podfile.read if Config.instance.project_podfile} #{Config.instance.project_podfile.read.strip if Config.instance.project_podfile}
``` ```
### Error ### Error
``` ```
#{error.message} #{error.message}
#{error.backtrace.join("\n ")} #{error.backtrace.join("\n")}
``` ```
#{'――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
#{'[!] Oh no, an error occurred.'.red}
#{error_from_podfile(error)}
#{'Search for existing github issues similar to yours:'.yellow}
#{"https://github.com/CocoaPods/CocoaPods/issues/search?q=#{CGI.escape(error.message)}"}
#{'If none exists, create a ticket, with the template displayed above, on:'.yellow}
https://github.com/CocoaPods/CocoaPods/issues/new
Don't forget to anonymize any private data!
EOS EOS
end end
...@@ -62,7 +64,7 @@ EOS ...@@ -62,7 +64,7 @@ EOS
def error_from_podfile(error) def error_from_podfile(error)
if error.message =~ /Podfile:(\d*)/ if error.message =~ /Podfile:(\d*)/
"It appears to have originated from your Podfile at line #{$1}." "\nIt appears to have originated from your Podfile at line #{$1}.\n"
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment