Class: Fastlane::Runner
- Inherits:
-
Object
- Object
- Fastlane::Runner
- Defined in:
- lib/fastlane/runner.rb
Instance Method Summary collapse
- #after_all_blocks ⇒ Object
- #available_lanes(filter_platform = nil) ⇒ Object
- #before_all_blocks ⇒ Object
- #blocks ⇒ Object
- #description_blocks ⇒ Object
- #error_blocks ⇒ Object
-
#execute(lane, platform = nil) ⇒ Object
This will take care of executing one lane.
- #set_after_all(platform, block) ⇒ Object
-
#set_before_all(platform, block) ⇒ Object
Called internally.
- #set_block(lane, platform, block, desc = nil) ⇒ Object
- #set_error(platform, block) ⇒ Object
Instance Method Details
#after_all_blocks ⇒ Object
103 104 105 |
# File 'lib/fastlane/runner.rb', line 103 def after_all_blocks @after_all ||= {} end |
#available_lanes(filter_platform = nil) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/fastlane/runner.rb', line 56 def available_lanes(filter_platform = nil) all = [] blocks.each do |platform, lane| next if (filter_platform and filter_platform.to_s != platform.to_s) # skip actions that don't match lane.each do |lane_name, block| all << [platform, lane_name].reject(&:nil?).join(' ') end end all end |
#before_all_blocks ⇒ Object
99 100 101 |
# File 'lib/fastlane/runner.rb', line 99 def before_all_blocks @before_all ||= {} end |
#blocks ⇒ Object
95 96 97 |
# File 'lib/fastlane/runner.rb', line 95 def blocks @blocks ||= {} end |
#description_blocks ⇒ Object
111 112 113 |
# File 'lib/fastlane/runner.rb', line 111 def description_blocks @description_blocks ||= {} end |
#error_blocks ⇒ Object
107 108 109 |
# File 'lib/fastlane/runner.rb', line 107 def error_blocks @error_blocks ||= {} end |
#execute(lane, platform = nil) ⇒ Object
This will take care of executing one lane.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 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 |
# File 'lib/fastlane/runner.rb', line 7 def execute(lane, platform = nil) raise "No lane given" unless lane lane = lane.to_sym platform = platform.to_sym if platform # might be nil, which is okay => root element Actions.lane_context[Actions::SharedValues::PLATFORM_NAME] = platform # set this in any case: important full_lane_name = [platform, lane].reject(&:nil?).join(' ') Helper.log.info "Driving the lane '#{full_lane_name}'".green Actions.lane_context[Actions::SharedValues::LANE_NAME] = full_lane_name ENV["FASTLANE_LANE_NAME"] = full_lane_name 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 unless (blocks[platform][lane] rescue nil) raise "Could not find lane '#{full_lane_name}'. Available lanes: #{available_lanes.join(', ')}".red end # Call the platform specific before_all block and then the general one before_all_blocks[platform].call(lane) if (before_all_blocks[platform] and platform != nil) before_all_blocks[nil].call(lane) if before_all_blocks[nil] return_val = blocks[platform][lane].call # `after_all` is only called if no exception was raised before # Call the platform specific before_all block and then the general one after_all_blocks[platform].call(lane) if (after_all_blocks[platform] and platform != nil) after_all_blocks[nil].call(lane) if (after_all_blocks[nil]) end return return_val rescue => ex Dir.chdir(path_to_use) do # Provide error block exception without colour code error_ex = ex.exception(ex..gsub(/\033\[\d+m/, '')) error_blocks[platform].call(lane, error_ex) if (error_blocks[platform] and platform != nil) error_blocks[nil].call(lane, error_ex) if error_blocks[nil] end raise ex end |
#set_after_all(platform, block) ⇒ Object
73 74 75 |
# File 'lib/fastlane/runner.rb', line 73 def set_after_all(platform, block) after_all_blocks[platform] = block end |
#set_before_all(platform, block) ⇒ Object
Called internally
69 70 71 |
# File 'lib/fastlane/runner.rb', line 69 def set_before_all(platform, block) before_all_blocks[platform] = block end |
#set_block(lane, platform, block, desc = nil) ⇒ Object
85 86 87 88 89 90 91 92 93 |
# File 'lib/fastlane/runner.rb', line 85 def set_block(lane, platform, block, desc = nil) blocks[platform] ||= {} description_blocks[platform] ||= {} raise "Lane '#{lane}' was defined multiple times!".red if blocks[platform][lane] blocks[platform][lane] = block description_blocks[platform][lane] = desc end |
#set_error(platform, block) ⇒ Object
77 78 79 |
# File 'lib/fastlane/runner.rb', line 77 def set_error(platform, block) error_blocks[platform] = block end |