Method: Fastlane::Runner#execute
- Defined in:
- fastlane/lib/fastlane/runner.rb
#execute(lane, platform = nil, parameters = nil) ⇒ Object
This will take care of executing one lane. That’s when the user triggers a lane from the CLI for example This method is not executed when switching a lane
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'fastlane/lib/fastlane/runner.rb', line 21 def execute(lane, platform = nil, parameters = nil) UI.crash!("No lane given") unless lane self.current_lane = lane.to_sym self.current_platform = (platform ? platform.to_sym : nil) lane_obj = lanes.fetch(current_platform, {}).fetch(current_lane, nil) UI.user_error!("Could not find lane '#{full_lane_name}'. Available lanes: #{available_lanes.join(', ')}") unless lane_obj UI.user_error!("You can't call the private lane '#{lane}' directly") if lane_obj.is_private ENV["FASTLANE_LANE_NAME"] = current_lane.to_s ENV["FASTLANE_PLATFORM_NAME"] = (current_platform ? current_platform.to_s : nil) Actions.lane_context[Actions::SharedValues::PLATFORM_NAME] = current_platform Actions.lane_context[Actions::SharedValues::LANE_NAME] = full_lane_name UI.success("Driving the lane '#{full_lane_name}' 🚀") return_val = nil path_to_use = FastlaneCore::FastlaneFolder.path || Dir.pwd parameters ||= {} # by default no parameters begin Dir.chdir(path_to_use) do # the file is located in the fastlane folder execute_flow_block(before_all_blocks, current_platform, current_lane, parameters) execute_flow_block(before_each_blocks, current_platform, current_lane, parameters) return_val = lane_obj.call(parameters) # after blocks are only called if no exception was raised before # Call the platform specific after block and then the general one execute_flow_block(after_each_blocks, current_platform, current_lane, parameters) execute_flow_block(after_all_blocks, current_platform, current_lane, parameters) end return return_val rescue => ex Dir.chdir(path_to_use) do # Provide error block exception without color code begin error_blocks[current_platform].call(current_lane, ex, parameters) if current_platform && error_blocks[current_platform] error_blocks[nil].call(current_lane, ex, parameters) if error_blocks[nil] rescue => error_block_exception UI.error("An error occurred while executing the `error` block:") UI.error(error_block_exception.to_s) raise ex # raise the original error message end end raise ex end end |