Commit 9aa02e59 authored by Danielle Tomlinson's avatar Danielle Tomlinson Committed by GitHub

Merge pull request #5950 from CocoaPods/orta-gh_inspector_2

Expand the usage of the GH Inspector to all of pod install
parents fffa804d 162d573b
......@@ -16,6 +16,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#5837](https://github.com/CocoaPods/CocoaPods/pull/5837)
* GitHub issue inspection will now happen for any StandardError in a pod install
[Orta Therox](https://github.com/orta)
[#5950](https://github.com/CocoaPods/CocoaPods/pull/5950)
##### Bug Fixes
......
require 'gh_inspector'
module Pod
class Command
class Install < Command
......@@ -35,6 +37,15 @@ module Pod
installer.repo_update = repo_update?(:default => false)
installer.update = false
installer.install!
rescue StandardError => e
search_for_exceptions(e)
raise e
end
def search_for_exceptions(exception)
inspector = GhInspector::Inspector.new 'cocoapods', 'cocoapods'
message_delegate = UserInterface::InspectorReporter.new
inspector.search_exception exception, message_delegate
end
end
end
......
......@@ -27,5 +27,35 @@ module Pod
run_command('install', '--repo-update')
end
end
describe 'Issue Inspection' do
before do
file = temporary_directory + 'Podfile'
File.open(file, 'w') do |f|
f.puts('platform :ios')
f.puts('pod "Reachability"')
end
end
it 'passes raised StandardError to the GH Inspector' do
error = StandardError
# Replace first method call with raising an error
Pod::Command.any_instance.expects(:installer_for_config).raises(error, 'message')
# Ensure that gh inspector is called
Command::Install.any_instance.expects(:search_for_exceptions).returns('')
lambda { run_command('install') }.should.raise error
end
it 'does not pass CP Informative errors to the GH Inspector' do
error = Pod::Informative
Pod::Command.any_instance.expects(:installer_for_config).raises(error, 'message')
# Ensure that gh inspector is not called
Command::Install.any_instance.expects(:search_for_exceptions).never
lambda { run_command('install') }.should.raise error
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