lib/gym/error_handler.rb in gym-1.2.0 vs lib/gym/error_handler.rb in gym-1.3.0

- old
+ new

@@ -47,11 +47,11 @@ print "You'll have to restart your shell session after updating the file." print "If you are using zshell or another shell, make sure to edit the correct bash file." print "For more information visit this stackoverflow answer:" print "https://stackoverflow.com/a/17031697/445598" end - raise "Error building the application - see the log above".red + UI.user_error!("Error building the application - see the log above") end # @param [Array] The output of the errored build (line by line) # This method should raise an exception in any case, as the return code indicated a failed build def handle_package_error(output) @@ -81,15 +81,18 @@ when /expected one of \{\}/ print "It seems like you ran into this radar" print "https://openradar.appspot.com/radar?id=4952000420642816" print "You can temporary use the :use_legacy_build_api option to get the build to work again" when /IDEDistributionErrorDomain error 1/ + when /Error Domain=IDEDistributionErrorDomain Code=/ + standard_output = read_standard_output output + print standard_output if standard_output print "There was an error exporting your application" print "Unfortunately the new Xcode export API is unstable and causes problems on some project" print "You can temporary use the :use_legacy_build_api option to get the build to work again" end - raise "Error packaging up the application".red + UI.user_error!("Error packaging up the application") end def handle_empty_archive print "The generated archive is invalid, this can have various reasons:" print "Usually it's caused by the `Skip Install` option in Xcode, set it to `NO`" @@ -97,14 +100,24 @@ print "Also, make sure to have a valid code signing identity and provisioning profile installed" print "Follow this guide to setup code signing https://github.com/KrauseFx/fastlane/blob/master/docs/CodeSigning.md" raise "Archive invalid" end + def find_standard_output_path(output) + m = /Created bundle at path '(.*)'/.match(output) + return File.join(m[1], 'IDEDistribution.standard.log') unless m.nil? + end + private + def read_standard_output(output) + path = find_standard_output_path output + return File.read(path) if File.exist?(path) + end + # Just to make things easier def print(text) - Helper.log.error text.red + UI.error text end end end end