Commit dc031742 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge remote-tracking branch 'upstream/master'

* upstream/master:
  Fix .kick script for Kicker 2.5.0
  Print a template for a new ticket when an error occurs. See #163.
parents 98c972e0 bd53fda1
recipe :ruby
Ruby.runner_bin = 'macbacon'
Kicker::Recipes::Ruby.runner_bin = 'bacon'
process do |files|
specs = files.take_and_map do |file|
......@@ -10,5 +10,5 @@ process do |files|
s unless s.empty?
end
end
Ruby.run_tests(specs)
Kicker::Recipes::Ruby.run_tests(specs)
end
module Pod
class Command
autoload :ErrorReport, 'cocoapods/command/error_report'
autoload :Install, 'cocoapods/command/install'
autoload :List, 'cocoapods/command/list'
autoload :Repo, 'cocoapods/command/repo'
autoload :Search, 'cocoapods/command/search'
autoload :List, 'cocoapods/command/list'
autoload :Setup, 'cocoapods/command/setup'
autoload :Spec, 'cocoapods/command/spec'
......@@ -52,13 +53,12 @@ module Pod
def self.run(*argv)
parse(*argv).run
rescue Exception => e
unless e.is_a?(Informative)
puts "Oh no, an error occurred. Please run with `--verbose' and report " \
"on https://github.com/CocoaPods/CocoaPods/issues."
puts ""
end
if e.is_a?(Informative)
puts e.message
puts *e.backtrace if Config.instance.verbose
else
puts ErrorReport.report(e)
end
exit 1
end
......
require 'rbconfig'
require 'cgi'
module Pod
class Command
module ErrorReport
class << self
def report(error)
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 following information to:
https://github.com/CocoaPods/CocoaPods/issues/new
Don't forget to anonymize any private data!
### Stack
* Host version: #{host_information}
* Xcode version: #{xcode_information}
* Ruby version: #{RUBY_DESCRIPTION}
* Ruby lib dir: #{RbConfig::CONFIG['libdir']}
* RubyGems version: #{Gem::VERSION}
* CocoaPods version: #{Pod::VERSION}
* Specification repositories:
- #{repo_information.join("\n - ")}
### Podfile
```ruby
#{Config.instance.project_podfile.read}
```
### Error
```
#{error.message}
#{error.backtrace.join("\n ")}
```
EOS
end
private
def error_from_podfile(error)
if error.message =~ /Podfile:(\d*)/
"It appears to have originated from your Podfile at line #{$1}."
end
end
def host_information
product, version, build =`sw_vers`.strip.split("\n").map { |line| line.split(":").last.strip }
"#{product} #{version} (#{build})"
end
def xcode_information
version, build = `xcodebuild -version`.strip.split("\n").map { |line| line.split(" ").last }
"#{version} (#{build})"
end
def repo_information
Pod::Source.all.map do |source|
repo = source.repo
Dir.chdir(repo) do
url = `git config --get remote.origin.url`.strip
sha = `git rev-parse HEAD`.strip
"#{repo.basename} - #{url} @ #{sha}"
end
end
end
end
end
end
end
......@@ -39,6 +39,7 @@ module Pod
def project_podfile
unless @project_podfile
@project_podfile = project_root + 'Podfile'
# TODO this has to go, we don't support this anymore!
unless @project_podfile.exist?
@project_podfile = project_root.glob('*.podspec').first
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