fastlane/lib/fastlane/runner.rb in fastlane-2.21.0.beta.20170317010039 vs fastlane/lib/fastlane/runner.rb in fastlane-2.21.0.beta.20170318010107

- old
+ new

@@ -99,10 +99,21 @@ return class_ref if class_ref && class_ref.respond_to?(:run) nil end + # Pass a action alias symbol (e.g. :enable_automatic_code_signing) + # and this method will return a reference to the action class + # if it exists. In case the action with this alias can't be found + # this method will return nil. + def class_reference_from_action_alias(method_sym) + alias_found = find_alias(method_sym.to_s) + return nil unless alias_found + + class_reference_from_action_name(alias_found.to_sym) + end + # lookup if an alias exists def find_alias(action_name) Actions.alias_actions.each do |key, v| next unless Actions.alias_actions[key] next unless Actions.alias_actions[key].include?(action_name) @@ -117,17 +128,15 @@ # If so, it won't show up in summary. def trigger_action_by_name(method_sym, custom_dir, from_action, *arguments) # First, check if there is a predefined method in the actions folder class_ref = class_reference_from_action_name(method_sym) unless class_ref - alias_found = find_alias(method_sym.to_s) - if alias_found + class_ref = class_reference_from_action_alias(method_sym) + # notify action that it has been used by alias + if class_ref.respond_to?(:alias_used) orig_action = method_sym.to_s - class_ref = class_reference_from_action_name(alias_found.to_sym) - # notify action that it has been used by alias - if class_ref.respond_to?(:alias_used) - class_ref.alias_used(orig_action, arguments.first) - end + arguments = [{}] if arguments.empty? + class_ref.alias_used(orig_action, arguments.first) end end # It's important to *not* have this code inside the rescue block # otherwise all NameErrors will be caught and the error message is