module Pod::UserInterface::ErrorReport

def error_from_podfile(error)

def error_from_podfile(error)
  if error.message =~ /Podfile:(\d*)/
    "\nIt appears to have originated from your Podfile at line #{$1}.\n"
  end
end

def host_information

def host_information
  product, version, build =`sw_vers`.strip.split("\n").map { |line| line.split(":").last.strip }
  "#{product} #{version} (#{build})"
end

def markdown_podfile

def markdown_podfile
  return '' unless Config.instance.podfile_path && Config.instance.podfile_path.exist?
  <<-EOS
ile
.instance.podfile_path.read.strip}
end

def repo_information

def repo_information
  SourcesManager.all.map do |source|
    repo = source.repo
    Dir.chdir(repo) do
      url = `git config --get remote.origin.url 2>&1`.strip
      sha = `git rev-parse HEAD 2>&1`.strip
      "#{repo.basename} - #{url} @ #{sha}"
    end
  end
end

def report(exception)

def report(exception)
  return <<-EOS
ARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
rt
id you do?
id you expect to happen?
appened instead?
k
Pods : #{Pod::VERSION}
Ruby : #{RUBY_DESCRIPTION}
Gems : #{Gem::VERSION}
Host : #{host_information}
code : #{xcode_information}
 dir : #{RbConfig::CONFIG['libdir']}
ries : #{repo_information.join("\n               ")}
wn_podfile}
r
ion.class} - #{exception.message}
ion.backtrace.join("\n")}
EMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
h no, an error occurred.'.red}
from_podfile(exception)}
h for existing github issues similar to yours:'.yellow}
://github.com/CocoaPods/CocoaPods/search?q=#{CGI.escape(exception.message)}&type=Issues"}
ne exists, create a ticket, with the template displayed above, on:'.yellow}
github.com/CocoaPods/CocoaPods/issues/new
rget to anonymize any private data!
end

def xcode_information

def xcode_information
  version, build = `xcodebuild -version`.strip.split("\n").map { |line| line.split(" ").last }
  "#{version} (#{build})"
end