fastlane/lib/fastlane/runner.rb in fastlane-2.81.0.beta.20180212010003 vs fastlane/lib/fastlane/runner.rb in fastlane-2.81.0.beta.20180213010002

- old
+ new

@@ -140,37 +140,40 @@ end # It's important to *not* have this code inside the rescue block # otherwise all NameErrors will be caught and the error message is # confusing + begin + return self.try_switch_to_lane(method_sym, arguments) + rescue LaneNotAvailableError + # We don't actually handle this here yet + # We just try to use a user configured lane first + # and only if there is none, we're gonna check for the + # built-in actions + end + if class_ref if class_ref.respond_to?(:run) # Action is available, now execute it return self.execute_action(method_sym, class_ref, arguments, custom_dir: custom_dir, from_action: from_action) else UI.user_error!("Action '#{method_sym}' of class '#{class_name}' was found, but has no `run` method.") end + end + + # No lane, no action, let's at least show the correct error message + if Fastlane.plugin_manager.plugin_is_added_as_dependency?(PluginManager.plugin_prefix + method_sym.to_s) + # That's a plugin, but for some reason we can't find it + UI.user_error!("Plugin '#{method_sym}' was not properly loaded, make sure to follow the plugin docs for troubleshooting: #{PluginManager::TROUBLESHOOTING_URL}") + elsif Fastlane::Actions.formerly_bundled_actions.include?(method_sym.to_s) + # This was a formerly bundled action which is now a plugin. + UI.verbose(caller.join("\n")) + UI.user_error!("The action '#{method_sym}' is no longer bundled with fastlane. You can install it using `fastlane add_plugin #{method_sym}`") else - # Action was not found - # Is there a lane under this name? - begin - return self.try_switch_to_lane(method_sym, arguments) - rescue LaneNotAvailableError - # No lane, no action, let's at least show the correct error message - if Fastlane.plugin_manager.plugin_is_added_as_dependency?(PluginManager.plugin_prefix + method_sym.to_s) - # That's a plugin, but for some reason we can't find it - UI.user_error!("Plugin '#{method_sym}' was not properly loaded, make sure to follow the plugin docs for troubleshooting: #{PluginManager::TROUBLESHOOTING_URL}") - elsif Fastlane::Actions.formerly_bundled_actions.include?(method_sym.to_s) - # This was a formerly bundled action which is now a plugin. - UI.verbose(caller.join("\n")) - UI.user_error!("The action '#{method_sym}' is no longer bundled with fastlane. You can install it using `fastlane add_plugin #{method_sym}`") - else - # So there is no plugin under that name, so just show the error message generated by the lane switch - UI.verbose(caller.join("\n")) - UI.user_error!("Could not find action, lane or variable '#{method_sym}'. Check out the documentation for more details: https://docs.fastlane.tools/actions") - end - end + # So there is no plugin under that name, so just show the error message generated by the lane switch + UI.verbose(caller.join("\n")) + UI.user_error!("Could not find action, lane or variable '#{method_sym}'. Check out the documentation for more details: https://docs.fastlane.tools/actions") end end # # All the methods that are usually called on execution @@ -225,10 +228,11 @@ FastlaneCore.session.action_launched(launch_context: launch_context) Dir.chdir(custom_dir) do # go up from the fastlane folder, to the project folder # If another action is calling this action, we shouldn't show it in the summary # (see https://github.com/fastlane/fastlane/issues/4546) + action_name = from_action ? nil : class_ref.step_text Actions.execute_action(action_name) do # arguments is an array by default, containing an hash with the actual parameters # Since we usually just need the passed hash, we'll just use the first object if there is only one if arguments.count == 0 @@ -246,10 +250,9 @@ puts("==========================================".deprecated) puts("This action (#{method_sym}) is deprecated".deprecated) puts(class_ref.deprecated_notes.to_s.deprecated) if class_ref.deprecated_notes puts("==========================================\n".deprecated) end - class_ref.runner = self # needed to call another action form an action return_value = class_ref.run(arguments) action_completed(method_sym.to_s, status: FastlaneCore::ActionCompletionStatus::SUCCESS)