Sha256: d87078387c9192ba5ec1a9175fdf694097fc850f4ba1cdbd613d6ffb04dce535
Contents?: true
Size: 1.75 KB
Versions: 2
Compression:
Stored size: 1.75 KB
Contents
module Fastlane class Runner def execute(key) key = key.to_sym Helper.log.info "Driving the lane '#{key}'".green Actions.lane_context[Actions::SharedValues::LANE_NAME] = key ENV["FASTLANE_LANE_NAME"] = key.to_s return_val = nil path_to_use = Fastlane::FastlaneFolder.path || Dir.pwd Dir.chdir(path_to_use) do # the file is located in the fastlane folder @before_all.call(key) if @before_all return_val = nil if blocks[key] return_val = blocks[key].call else raise "Could not find lane for type '#{key}'. Available lanes: #{available_lanes.join(', ')}".red end @after_all.call(key) if @after_all # this is only called if no exception was raised before end return return_val rescue => ex Dir.chdir(path_to_use) do # Provide error block exception without colour code error_ex = ex.exception(ex.message.gsub(/\033\[\d+m/, '')) @error.call(key, error_ex) if @error # notify the block end raise ex end def available_lanes blocks.keys end # Called internally def set_before_all(block) @before_all = block end def set_after_all(block) @after_all = block end def set_error(block) @error = block end # @param key: The name of the lane # @param block: The block of the lane # @param desc: Description of this action def set_block(key, block, desc = nil) raise "Lane '#{key}' was defined multiple times!".red if blocks[key] blocks[key] = block description_blocks[key] = desc end def blocks @blocks ||= {} end def description_blocks @description_blocks ||= {} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fastlane-0.10.0 | lib/fastlane/runner.rb |
fastlane-0.9.0 | lib/fastlane/runner.rb |